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