in video player, while playing, fire a position event for every full minute, reducing the need for saving the video position on unload

This commit is contained in:
rlx 2011-11-06 09:05:21 +00:00
parent 01306dd5ae
commit 1cf7566eeb

View file

@ -1630,7 +1630,10 @@ Ox.VideoPlayer = function(options, self) {
} }
function playing() { function playing() {
var minute,
previousMinute = parseInt(self.options.position / 60);
self.options.position = self.$video.currentTime(); self.options.position = self.$video.currentTime();
minute = parseInt(self.options.position / 60);
if ( if (
(self.playInToOut && self.options.position >= self.options.out) (self.playInToOut && self.options.position >= self.options.out)
|| (self.options.playInToOut && self.options.position >= self.out) || (self.options.playInToOut && self.options.position >= self.out)
@ -1654,6 +1657,9 @@ Ox.VideoPlayer = function(options, self) {
that.triggerEvent('playing', { that.triggerEvent('playing', {
position: self.options.position position: self.options.position
}); });
minute != previousMinute && that.triggerEvent('position', {
position: minute * 60
});
} }
function playInToOut() { function playInToOut() {