bind seeking directly before seek

This commit is contained in:
j 2014-02-10 10:35:49 +00:00
parent 635a26dc48
commit 861452512f

View file

@ -143,14 +143,6 @@ Ox.VideoElement = function(options, self) {
progress: function() {
// not implemented
},
seeked: function() {
if (self.video == this) {
if (self.loadedMetadata && self.seeking && !self.loading) {
that.triggerEvent('seeked');
self.seeking = false;
}
}
},
seeking: function() {
//seeking event triggered in setCurrentTime
},
@ -220,10 +212,12 @@ Ox.VideoElement = function(options, self) {
next = self.items[nextItem],
$nextVideo = self.$videos[Ox.mod(self.currentVideo + 1, self.$videos.length)],
nextVideo = $nextVideo[0];
nextVideo.src = next.src;
onLoadedMetadata($nextVideo, function() {
$nextVideo.one('loadedmetadata', function() {
if (self.video != nextVideo) {
nextVideo.currentTime = next['in'] || 0;
}
});
nextVideo.src = next.src;
}
function onLoadedMetadata($video, callback) {
@ -263,6 +257,8 @@ Ox.VideoElement = function(options, self) {
self.loadedMetadata = true;
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('itemchange', {
item: self.currentItem
@ -298,20 +294,17 @@ Ox.VideoElement = function(options, self) {
self.video.volume = volume;
self.video.muted = muted;
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);
onLoadedMetadata(self.$video, function(video) {
self.$video.one('seeked', function() {
self.loading = false;
!self.paused && self.video.play();
self.$video.show();
if (self.seeking) {
that.triggerEvent('seeked');
self.seeking = false;
}
callback && callback();
loadNextVideo();
});
Ox.Log('Video', 'sCV set in', video.src, item['in'] || 0, video.currentTime, video.seeking);
video.currentTime = item['in'] || 0;
});
}
@ -319,13 +312,17 @@ Ox.VideoElement = function(options, self) {
function setCurrentItemTime(currentTime) {
Ox.Log('Video', 'sCIT', currentTime, self.video.currentTime,
'delta', currentTime - self.video.currentTime);
if (currentTime != self.video.currentTime) {
onLoadedMetadata(self.$video, function(video) {
video.currentTime = currentTime;
});
} else {
if (self.video == video) {
if(self.seeking) {
self.$video.one('seeked', function() {
that.triggerEvent('seeked');
self.seeking = false;
});
}
video.currentTime = currentTime;
}
});
}
function setCurrentTime(time) {