bind seeking directly before seek
This commit is contained in:
parent
635a26dc48
commit
861452512f
1 changed files with 19 additions and 22 deletions
|
@ -143,14 +143,6 @@ Ox.VideoElement = function(options, self) {
|
||||||
progress: function() {
|
progress: function() {
|
||||||
// not implemented
|
// not implemented
|
||||||
},
|
},
|
||||||
seeked: function() {
|
|
||||||
if (self.video == this) {
|
|
||||||
if (self.loadedMetadata && self.seeking && !self.loading) {
|
|
||||||
that.triggerEvent('seeked');
|
|
||||||
self.seeking = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
seeking: function() {
|
seeking: function() {
|
||||||
//seeking event triggered in setCurrentTime
|
//seeking event triggered in setCurrentTime
|
||||||
},
|
},
|
||||||
|
@ -220,10 +212,12 @@ Ox.VideoElement = function(options, self) {
|
||||||
next = self.items[nextItem],
|
next = self.items[nextItem],
|
||||||
$nextVideo = self.$videos[Ox.mod(self.currentVideo + 1, self.$videos.length)],
|
$nextVideo = self.$videos[Ox.mod(self.currentVideo + 1, self.$videos.length)],
|
||||||
nextVideo = $nextVideo[0];
|
nextVideo = $nextVideo[0];
|
||||||
nextVideo.src = next.src;
|
$nextVideo.one('loadedmetadata', function() {
|
||||||
onLoadedMetadata($nextVideo, function() {
|
if (self.video != nextVideo) {
|
||||||
nextVideo.currentTime = next['in'] || 0;
|
nextVideo.currentTime = next['in'] || 0;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
nextVideo.src = next.src;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoadedMetadata($video, callback) {
|
function onLoadedMetadata($video, callback) {
|
||||||
|
@ -263,6 +257,8 @@ Ox.VideoElement = function(options, self) {
|
||||||
self.loadedMetadata = true;
|
self.loadedMetadata = true;
|
||||||
that.triggerEvent('loadedmetadata');
|
that.triggerEvent('loadedmetadata');
|
||||||
}
|
}
|
||||||
|
Ox.Log('Video', 'sCI', 'trigger itemchange',
|
||||||
|
self.items[self.currentItem]['in'], self.video.currentTime, self.video.seeking);
|
||||||
that.triggerEvent('sizechange');
|
that.triggerEvent('sizechange');
|
||||||
that.triggerEvent('itemchange', {
|
that.triggerEvent('itemchange', {
|
||||||
item: self.currentItem
|
item: self.currentItem
|
||||||
|
@ -298,20 +294,17 @@ Ox.VideoElement = function(options, self) {
|
||||||
self.video.volume = volume;
|
self.video.volume = volume;
|
||||||
self.video.muted = muted;
|
self.video.muted = muted;
|
||||||
self.$video.css(css);
|
self.$video.css(css);
|
||||||
Ox.Log('Video', 'sCV', self.video.src, self.items[self.currentItem]['in'],
|
Ox.Log('Video', 'sCV', self.video.src, item['in'],
|
||||||
self.video.currentTime, self.video.seeking);
|
self.video.currentTime, self.video.seeking);
|
||||||
onLoadedMetadata(self.$video, function(video) {
|
onLoadedMetadata(self.$video, function(video) {
|
||||||
self.$video.one('seeked', function() {
|
self.$video.one('seeked', function() {
|
||||||
self.loading = false;
|
self.loading = false;
|
||||||
!self.paused && self.video.play();
|
!self.paused && self.video.play();
|
||||||
self.$video.show();
|
self.$video.show();
|
||||||
if (self.seeking) {
|
|
||||||
that.triggerEvent('seeked');
|
|
||||||
self.seeking = false;
|
|
||||||
}
|
|
||||||
callback && callback();
|
callback && callback();
|
||||||
loadNextVideo();
|
loadNextVideo();
|
||||||
});
|
});
|
||||||
|
Ox.Log('Video', 'sCV set in', video.src, item['in'] || 0, video.currentTime, video.seeking);
|
||||||
video.currentTime = item['in'] || 0;
|
video.currentTime = item['in'] || 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -319,13 +312,17 @@ Ox.VideoElement = function(options, self) {
|
||||||
function setCurrentItemTime(currentTime) {
|
function setCurrentItemTime(currentTime) {
|
||||||
Ox.Log('Video', 'sCIT', currentTime, self.video.currentTime,
|
Ox.Log('Video', 'sCIT', currentTime, self.video.currentTime,
|
||||||
'delta', currentTime - self.video.currentTime);
|
'delta', currentTime - self.video.currentTime);
|
||||||
if (currentTime != self.video.currentTime) {
|
|
||||||
onLoadedMetadata(self.$video, function(video) {
|
onLoadedMetadata(self.$video, function(video) {
|
||||||
video.currentTime = currentTime;
|
if (self.video == video) {
|
||||||
});
|
if(self.seeking) {
|
||||||
} else {
|
self.$video.one('seeked', function() {
|
||||||
that.triggerEvent('seeked');
|
that.triggerEvent('seeked');
|
||||||
|
self.seeking = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
video.currentTime = currentTime;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCurrentTime(time) {
|
function setCurrentTime(time) {
|
||||||
|
|
Loading…
Reference in a new issue