fix seeking event for multipart videos that load at the beginning of a part, fixes #3065
This commit is contained in:
parent
c02a08c8d9
commit
de72a11364
1 changed files with 33 additions and 14 deletions
|
@ -346,38 +346,57 @@ Ox.VideoElement = function(options, self) {
|
|||
self.currentVideo = Ox.mod(self.currentVideo + 1, self.$videos.length);
|
||||
self.$video = self.$videos[self.currentVideo];
|
||||
self.video = self.$video[0];
|
||||
self.video.muted = true; // avoid sound glitch during load
|
||||
if (self.$video.attr('src') != item.src) {
|
||||
self.loadedMetadata && Ox.Log('Video', 'caching next item failed, reset src');
|
||||
self.video.src = item.src;
|
||||
self.video.preload = 'auto';
|
||||
}
|
||||
self.video.volume = getVolume();
|
||||
self.video.muted = muted;
|
||||
self.video.playbackRate = self.options.playbackRate;
|
||||
self.$video.css(css);
|
||||
self.buffering = true;
|
||||
Ox.Log('Video', 'sCV', self.video.src, item['in'],
|
||||
self.video.currentTime, self.video.seeking);
|
||||
isReady(self.$video, function(video) {
|
||||
self.$video.one('seeked', function() {
|
||||
Ox.Log('Video', 'sCV', 'seeked callback');
|
||||
var in_ = item['in'] || 0;
|
||||
|
||||
function ready() {
|
||||
Ox.Log('Video', 'sCV', 'ready');
|
||||
self.loading = false;
|
||||
self.video.muted = muted;
|
||||
!self.paused && self.video.play();
|
||||
self.$video.show();
|
||||
callback && callback();
|
||||
loadNextVideo();
|
||||
});
|
||||
if (!self.seeking) {
|
||||
Ox.Log('Video', 'sCV set in', video.src, item['in'] || 0, video.currentTime, video.seeking);
|
||||
video.currentTime = item['in'] || 0;
|
||||
if (self.paused) {
|
||||
var promise = self.video.play();
|
||||
if (promise) {
|
||||
promise.then(function() {
|
||||
}
|
||||
if (video.currentTime == in_) {
|
||||
Ox.Log('Video', 'sCV', 'already at position');
|
||||
self.seeking = false;
|
||||
ready();
|
||||
} else {
|
||||
self.$video.one('seeked', function() {
|
||||
Ox.Log('Video', 'sCV', 'seeked callback');
|
||||
ready();
|
||||
});
|
||||
if (!self.seeking) {
|
||||
Ox.Log('Video', 'sCV set in', video.src, in_, video.currentTime, video.seeking);
|
||||
self.seeking = true;
|
||||
video.currentTime = in_;
|
||||
if (self.paused) {
|
||||
var promise = self.video.play();
|
||||
if (promise !== undefined) {
|
||||
promise.then(function() {
|
||||
self.video.pause();
|
||||
self.video.muted = muted;
|
||||
}).catch(function() {
|
||||
self.video.pause();
|
||||
self.video.muted = muted;
|
||||
});
|
||||
} else {
|
||||
self.video.pause();
|
||||
});
|
||||
} else {
|
||||
self.video.pause();
|
||||
self.video.muted = muted;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue