use setInterval instead of video.timeupdate, timeupdate does not fire often enough
This commit is contained in:
parent
9da1540653
commit
89e4368a0e
1 changed files with 11 additions and 10 deletions
|
@ -94,6 +94,16 @@ Ox.VideoElement = function(options, self) {
|
|||
opacity: 0
|
||||
})
|
||||
.appendTo(that);
|
||||
self.timeupdate = setInterval(function() {
|
||||
if (!self.paused
|
||||
&& !self.loading
|
||||
&& self.loadedMetadata
|
||||
&& self.items[self.currentItem]
|
||||
&& self.items[self.currentItem].out
|
||||
&& self.video.currentTime >= self.items[self.currentItem].out) {
|
||||
setCurrentItem(self.currentItem + 1);
|
||||
}
|
||||
}, 30);
|
||||
|
||||
loadItems(function() {
|
||||
setCurrentItem(0);
|
||||
|
@ -149,16 +159,6 @@ Ox.VideoElement = function(options, self) {
|
|||
self.video.pause();
|
||||
that.triggerEvent('ended');
|
||||
}
|
||||
},
|
||||
timeupdate: function() {
|
||||
//fixme: use setInterval(...,30); to be more accurate
|
||||
if (self.video == this) {
|
||||
if (self.items[self.currentItem]
|
||||
&& self.items[self.currentItem].out
|
||||
&& this.currentTime >= self.items[self.currentItem].out) {
|
||||
setCurrentItem(self.currentItem + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.attr({
|
||||
|
@ -446,6 +446,7 @@ Ox.VideoElement = function(options, self) {
|
|||
|
||||
that.superRemove = that.remove;
|
||||
that.remove = function() {
|
||||
clearInterval(self.timeupdate);
|
||||
//Chrome does not properly release resources, reset manually
|
||||
//http://code.google.com/p/chromium/issues/detail?id=31014
|
||||
self.$videos.forEach(function($video) {
|
||||
|
|
Loading…
Reference in a new issue