From 4eab471f9d2139a94d04120c67ca2cf8d56a5380 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 1 Aug 2013 08:39:20 +0000 Subject: [PATCH] video player: add keyboard shortcut and public method for loop, abort play-in-to-out on pause, minor cleanup --- source/Ox.UI/js/Video/VideoPlayer.js | 31 +++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/source/Ox.UI/js/Video/VideoPlayer.js b/source/Ox.UI/js/Video/VideoPlayer.js index 81a5da1b..1c792b47 100644 --- a/source/Ox.UI/js/Video/VideoPlayer.js +++ b/source/Ox.UI/js/Video/VideoPlayer.js @@ -297,15 +297,14 @@ Ox.VideoPlayer = function(options, self) { key_g: function() { goToNext('result', 1); }, + key_l: toggleLoop, key_left: function() { setPosition(self.options.position - self.secondsPerFrame); }, key_minus: function() { changeVolume(-0.1); }, - key_p: function() { - playInToOut(); - }, + key_p: playInToOut, key_right: function() { setPosition(self.options.position + self.secondsPerFrame); }, @@ -1788,6 +1787,11 @@ Ox.VideoPlayer = function(options, self) { return str.slice(0, -1).match(/^\d+$/) && str.slice(-1) == 'p'; } + function itemchange(data) { + var item = self.$video.options('items')[data.item]; + Ox.Log('Video', 'ITEMCHANGE', item); + } + function loadImage() { self.$image .one({ @@ -1895,8 +1899,6 @@ Ox.VideoPlayer = function(options, self) { } else { setPosition(self.playInToOut ? self.options.out : self.out/*, 'video'*/); } - self.playInToOut = false; - //ended(); that.triggerEvent('ended'); } } else { @@ -1915,11 +1917,6 @@ Ox.VideoPlayer = function(options, self) { } } - function itemchange(data) { - var item = self.$video.options('items')[data.item]; - Ox.Log('Video', 'ITEMCHANGE', item); - } - function progress() { var buffered = self.$video.buffered(); for (var i = 0; i < buffered.length; i++) { @@ -2522,6 +2519,7 @@ Ox.VideoPlayer = function(options, self) { opacity: 1 }, 250); } + self.playInToOut = false; } else { if (self.options.playInToOut && self.options.position > self.options.out - self.secondsPerFrame) { setPosition(self.options['in']); @@ -2613,6 +2611,15 @@ Ox.VideoPlayer = function(options, self) { return that; }; + /*@ + togglePaused toggle loop state + () -> toggle loop state + @*/ + that.toggleLoop = function() { + toggleLoop(); + return that; + }; + /*@ togglePaused toggle paused state () -> toggle paused state @@ -2620,7 +2627,7 @@ Ox.VideoPlayer = function(options, self) { that.togglePaused = function() { togglePaused(); return that; - } + }; /*@ toggleMuted toggle muted state @@ -2629,7 +2636,7 @@ Ox.VideoPlayer = function(options, self) { that.toggleMuted = function() { toggleMuted(); return that; - } + }; return that;