fix bugs in video player

This commit is contained in:
rlx 2011-12-23 05:19:02 +00:00
parent 5803633835
commit e719b6d219

View file

@ -795,7 +795,7 @@ Ox.VideoPlayer = function(options, self) {
self.$volumeButton = Ox.Button({ self.$volumeButton = Ox.Button({
style: 'symbol', style: 'symbol',
title: 'mute', title: getVolumeImage(),
tooltip: 'Volume', tooltip: 'Volume',
type: 'image' type: 'image'
}) })
@ -1000,7 +1000,9 @@ Ox.VideoPlayer = function(options, self) {
} }
} }
self.options.fullscreen ? setSizes(enterFullscreen) : setSizes(); setSizes(false, function() {
self.options.fullscreen && enterFullscreen();
});
function censor() { function censor() {
if (self.options.type == 'play') { if (self.options.type == 'play') {
@ -1399,7 +1401,7 @@ Ox.VideoPlayer = function(options, self) {
}; };
} }
function getVolumeImageURL() { function getVolumeImage() {
var symbol; var symbol;
if (self.options.muted || self.options.volume == 0) { if (self.options.muted || self.options.volume == 0) {
symbol = 'Unmute'; symbol = 'Unmute';
@ -1410,7 +1412,7 @@ Ox.VideoPlayer = function(options, self) {
} else { } else {
symbol = 'Mute'; symbol = 'Mute';
} }
return Ox.UI.getImageURL('symbol' + symbol); return symbol;
} }
function goToNextClip(direction) { function goToNextClip(direction) {
@ -1875,8 +1877,7 @@ Ox.VideoPlayer = function(options, self) {
} }
} }
function setSizes(callback) { function setSizes(animate, callback) {
var animate = !!callback;
self.width = self.options.fullscreen ? window.innerWidth : self.options.width; self.width = self.options.fullscreen ? window.innerWidth : self.options.width;
self.height = self.options.fullscreen ? window.innerHeight : self.options.height; self.height = self.options.fullscreen ? window.innerHeight : self.options.height;
self.videoCSS = getVideoCSS(); self.videoCSS = getVideoCSS();
@ -1975,8 +1976,8 @@ Ox.VideoPlayer = function(options, self) {
if (!!self.options.volume == self.options.muted) { if (!!self.options.volume == self.options.muted) {
toggleMuted(); toggleMuted();
} else { } else {
self.$volumeButton.attr({ self.$volumeButton.options({
src: getVolumeImageURL() title: getVolumeImage()
}); });
self.$volumeValue.html( self.$volumeValue.html(
self.options.muted ? 0 : Math.round(self.options.volume * 100) self.options.muted ? 0 : Math.round(self.options.volume * 100)
@ -2123,7 +2124,7 @@ Ox.VideoPlayer = function(options, self) {
zIndex: 1000 zIndex: 1000
}) })
.appendTo(Ox.UI.$body); .appendTo(Ox.UI.$body);
setSizes(function() { setSizes(true, function() {
playOnFullscreen && self.$video.play(); playOnFullscreen && self.$video.play();
enterFullscreen(); enterFullscreen();
}); });
@ -2136,7 +2137,7 @@ Ox.VideoPlayer = function(options, self) {
.unbind('mouseenter') .unbind('mouseenter')
.unbind('mouseleave'); .unbind('mouseleave');
clearTimeout(self.interfaceTimeout); clearTimeout(self.interfaceTimeout);
setSizes(function() { setSizes(true, function() {
self.exitFullscreen = false; self.exitFullscreen = false;
that.detach() that.detach()
.removeClass('OxFullscreen') .removeClass('OxFullscreen')
@ -2170,8 +2171,8 @@ Ox.VideoPlayer = function(options, self) {
if (self.$muteButton && from != 'button') { if (self.$muteButton && from != 'button') {
self.$muteButton.toggle(); self.$muteButton.toggle();
} }
self.$volumeButton && self.$volumeButton.attr({ self.$volumeButton && self.$volumeButton.options({
src: getVolumeImageURL() title: getVolumeImage()
}); });
self.$volumeInput && self.$volumeInput.value( self.$volumeInput && self.$volumeInput.value(
self.options.muted ? 0 : self.options.volume self.options.muted ? 0 : self.options.volume