in video player, trigger muted event also if caused indirectly by setting volume to zero or turning volume up while muted

This commit is contained in:
rlx 2011-11-05 15:27:53 +00:00
parent 1e8edb8388
commit d152c4b48b

View file

@ -1893,15 +1893,16 @@ Ox.VideoPlayer = function(options, self) {
function setVolume(volume) { function setVolume(volume) {
self.options.volume = volume; self.options.volume = volume;
if (!!self.options.volume == self.options.muted) { if (!!self.options.volume == self.options.muted) {
self.options.muted = !self.options.muted; toggleMuted();
self.$video.muted(self.options.muted); } else {
self.$muteButton.toggleTitle(); self.$volumeButton.attr({
src: getVolumeImageURL()
});
self.$volumeValue.html(
self.options.muted ? 0 : Math.round(self.options.volume * 100)
);
} }
!self.censored && self.$video.volume(self.options.volume); !self.censored && self.$video.volume(self.options.volume);
self.$volumeButton.attr({
src: getVolumeImageURL()
});
self.$volumeValue.html(self.options.muted ? 0 : Math.round(self.options.volume * 100));
that.triggerEvent('volume', { that.triggerEvent('volume', {
volume: self.options.volume volume: self.options.volume
}); });