diff --git a/source/Ox.UI/js/Video/VideoElement.js b/source/Ox.UI/js/Video/VideoElement.js index 4dd28a9f..175998aa 100644 --- a/source/Ox.UI/js/Video/VideoElement.js +++ b/source/Ox.UI/js/Video/VideoElement.js @@ -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) {