support per clip volume
This commit is contained in:
parent
34cdae0ab3
commit
bfb5c3d3ef
6 changed files with 78 additions and 18 deletions
|
|
@ -101,6 +101,7 @@ Ox.VideoElement = function(options, self) {
|
|||
self.$videos = [getVideo(), getVideo()];
|
||||
self.$video = self.$videos[self.currentVideo];
|
||||
self.video = self.$video[0];
|
||||
self.volume = 1;
|
||||
self.$brightness = $('<div>').css({
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
|
|
@ -204,6 +205,15 @@ Ox.VideoElement = function(options, self) {
|
|||
return $(video);
|
||||
};
|
||||
|
||||
function getVolume() {
|
||||
var volume = 1;
|
||||
if (self.items[self.currentItem] && Ox.isNumber(self.items[self.currentItem].volume)) {
|
||||
volume = self.items[self.currentItem].volume;
|
||||
}
|
||||
return self.volume * volume;
|
||||
}
|
||||
|
||||
|
||||
function isReady($video, callback) {
|
||||
if ($video[0].seeking) {
|
||||
that.triggerEvent('seeking');
|
||||
|
|
@ -320,7 +330,6 @@ Ox.VideoElement = function(options, self) {
|
|||
function setCurrentVideo(callback) {
|
||||
var css = {},
|
||||
muted = false,
|
||||
volume = 1,
|
||||
item = self.items[self.currentItem],
|
||||
next;
|
||||
Ox.Log('Video', 'sCV', item);
|
||||
|
|
@ -332,7 +341,6 @@ Ox.VideoElement = function(options, self) {
|
|||
if (self.video) {
|
||||
self.$videos[self.currentVideo].hide();
|
||||
self.video.pause();
|
||||
volume = self.video.volume;
|
||||
muted = self.video.muted;
|
||||
}
|
||||
self.currentVideo = Ox.mod(self.currentVideo + 1, self.$videos.length);
|
||||
|
|
@ -343,7 +351,7 @@ Ox.VideoElement = function(options, self) {
|
|||
self.video.src = item.src;
|
||||
self.video.preload = 'auto';
|
||||
}
|
||||
self.video.volume = volume;
|
||||
self.video.volume = getVolume();
|
||||
self.video.muted = muted;
|
||||
self.video.playbackRate = self.options.playbackRate;
|
||||
self.$video.css(css);
|
||||
|
|
@ -557,7 +565,13 @@ Ox.VideoElement = function(options, self) {
|
|||
volume <f> get/set volume
|
||||
@*/
|
||||
that.volume = function(value) {
|
||||
return getset('volume', arguments[0]);
|
||||
if (Ox.isUndefined(value)) {
|
||||
value = self.volume
|
||||
} else {
|
||||
self.volume = value;
|
||||
self.video.volume = getVolume());
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
return that;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue