From 1cf7566eeba6bfaf82b8313eb3edd13c0f3198ff Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 6 Nov 2011 09:05:21 +0000 Subject: [PATCH] in video player, while playing, fire a position event for every full minute, reducing the need for saving the video position on unload --- source/Ox.UI/js/Video/Ox.VideoPlayer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/Ox.UI/js/Video/Ox.VideoPlayer.js b/source/Ox.UI/js/Video/Ox.VideoPlayer.js index e3085e3d..921b528d 100644 --- a/source/Ox.UI/js/Video/Ox.VideoPlayer.js +++ b/source/Ox.UI/js/Video/Ox.VideoPlayer.js @@ -1630,7 +1630,10 @@ Ox.VideoPlayer = function(options, self) { } function playing() { + var minute, + previousMinute = parseInt(self.options.position / 60); self.options.position = self.$video.currentTime(); + minute = parseInt(self.options.position / 60); if ( (self.playInToOut && self.options.position >= self.options.out) || (self.options.playInToOut && self.options.position >= self.out) @@ -1654,6 +1657,9 @@ Ox.VideoPlayer = function(options, self) { that.triggerEvent('playing', { position: self.options.position }); + minute != previousMinute && that.triggerEvent('position', { + position: minute * 60 + }); } function playInToOut() {