From 7d188d86214bba354b8dc39c9620b7af2c45b9ab Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 19 Feb 2012 11:21:52 +0000 Subject: [PATCH] make +/- volume keyboard shortcut work in video and timeline views --- source/Ox.UI/js/Video/Ox.AnnotationFolder.js | 8 +++++--- source/Ox.UI/js/Video/Ox.AnnotationPanel.js | 8 +++++--- source/Ox.UI/js/Video/Ox.VideoEditor.js | 20 +++++++++++++++----- source/Ox.UI/js/Video/Ox.VideoPanel.js | 12 +++++++++--- source/Ox.UI/js/Video/Ox.VideoPlayer.js | 17 ++++++++++++----- 5 files changed, 46 insertions(+), 19 deletions(-) diff --git a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js index f15fd5d4..a5c7d532 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js @@ -255,9 +255,11 @@ Ox.AnnotationFolder = function(options, self) { [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'b', 'backslash', 'closebracket', 'comma', 'dot', 'equal', - 'f', 'g', 'h', 'i', 'minus', 'n', 'o', 'openbracket', 'p', - 'shift_0', 'shift_g', 'shift_i', 'shift_o', 'slash', 'space' + 'b', 'backslash', 'closebracket', 'comma', 'dot', + 'equal', 'f', 'g', 'h', 'i', 'minus', 'n', 'o', + 'openbracket', 'p', 'shift_0', 'shift_equal', + 'shift_g', 'shift_i', 'shift_minus', 'shift_o', + 'slash', 'space' ].forEach(function(key) { key = 'key_' + key; self.$annotations.bindEvent(key, function() { diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index c3e5e2b7..37cf77e3 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -125,9 +125,11 @@ Ox.AnnotationPanel = function(options, self) { .appendTo(self.$folders); [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'b', 'backslash', 'closebracket', 'comma', 'dot', 'equal', - 'f', 'g', 'h', 'i', 'minus', 'n', 'o', 'openbracket', 'p', - 'shift_0', 'shift_g', 'shift_i', 'shift_o', 'slash', 'space' + 'b', 'backslash', 'closebracket', 'comma', 'dot', + 'equal', 'f', 'g', 'h', 'i', 'minus', 'n', 'o', + 'openbracket', 'p', 'shift_0', 'shift_equal', + 'shift_g', 'shift_i', 'shift_minus', 'shift_o', + 'slash', 'space' ].forEach(function(key) { key = 'key_' + key; self.$folder[i].bindEvent(key, function() { diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 493ac5ba..93de2628 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -98,7 +98,7 @@ Ox.VideoEditor = function(options, self) { } }, key_equal: function() { - self.options.videoSize == 'small' && toggleSize(); + self.$player[0].changeVolume(0.1); }, key_escape: function() { if (self.editing) { @@ -123,7 +123,7 @@ Ox.VideoEditor = function(options, self) { movePositionBy(-0.04); }, key_minus: function() { - self.options.videoSize == 'large' && toggleSize(); + self.$player[0].changeVolume(-0.1); }, key_n: function() { self.annotations.length && selectAnnotation(getNextAnnotation('annotation', 1)); @@ -144,6 +144,9 @@ Ox.VideoEditor = function(options, self) { key_shift_down: function() { movePositionBy(self.options.duration); }, + key_shift_equal: function() { + self.options.videoSize == 'small' && toggleSize(); + }, key_shift_g: function() { self.results.length && selectAnnotation(getNextAnnotation('result', -1)); }, @@ -153,6 +156,9 @@ Ox.VideoEditor = function(options, self) { key_shift_i: function() { goToPoint('in'); }, + key_shift_minus: function() { + self.options.videoSize == 'large' && toggleSize(); + }, key_shift_o: function() { goToPoint('out'); }, @@ -370,6 +376,8 @@ Ox.VideoEditor = function(options, self) { {key: '0', action: 'Mute/Unmute'}, {key: '-', action: 'Turn Volume Down'}, {key: '+', action: 'Turn Volume Up'}, + {key: Ox.UI.symbols.shift + '-', action: 'Small Player'}, + {key: Ox.UI.symbols.shift + '+', action: 'Large Player'}, {key: Ox.UI.symbols.arrow_left, action: 'Go One Frame Back'}, {key: Ox.UI.symbols.arrow_right, action: 'Go One Frame Forward'}, {key: Ox.UI.symbols.shift + Ox.UI.symbols.arrow_left, action: 'Go One Second Back'}, @@ -683,9 +691,11 @@ Ox.VideoEditor = function(options, self) { [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'b', 'backslash', 'closebracket', 'comma', 'dot', 'equal', - 'f', 'g', 'h', 'i', 'minus', 'n', 'o', 'openbracket', 'p', - 'shift_0', 'shift_g', 'shift_i', 'shift_o', 'slash', 'space' + 'b', 'backslash', 'closebracket', 'comma', 'dot', + 'equal', 'f', 'g', 'h', 'i', 'minus', 'n', 'o', + 'openbracket', 'p', 'shift_0', 'shift_equal', + 'shift_g', 'shift_i', 'shift_minus', 'shift_o', + 'slash', 'space' ].forEach(function(key) { key = 'key_' + key; self.$annotationPanel.bindEvent(key, function() { diff --git a/source/Ox.UI/js/Video/Ox.VideoPanel.js b/source/Ox.UI/js/Video/Ox.VideoPanel.js index 8912f457..890bde88 100644 --- a/source/Ox.UI/js/Video/Ox.VideoPanel.js +++ b/source/Ox.UI/js/Video/Ox.VideoPanel.js @@ -62,6 +62,12 @@ Ox.VideoPanel = function(options, self) { .bindEvent({ resize: resizeElement, key_0: toggleMuted, + key_equal: function() { + self.$video.changeVolume(0.1); + }, + key_minus: function() { + self.$video.changeVolume(-0.1); + }, key_space: togglePaused }); @@ -239,9 +245,9 @@ Ox.VideoPanel = function(options, self) { }); [ - '0', 'b', 'backslash', 'closebracket', 'comma', 'dot', - 'f', 'g', 'i', 'n', 'o', 'openbracket', 'p', - 'shift_0', 'shift_g', 'shift_i', 'shift_o', 'slash', 'space' + '0', 'b', 'backslash', 'closebracket', 'comma', 'dot', 'equal', 'f', + 'g', 'i', 'minus', 'n', 'o', 'openbracket', 'p', 'shift_0', 'shift_g', + 'shift_i', 'shift_o', 'slash', 'space' ].forEach(function(key) { key = 'key_' + key; self.$annotationPanel.bindEvent(key, function() { diff --git a/source/Ox.UI/js/Video/Ox.VideoPlayer.js b/source/Ox.UI/js/Video/Ox.VideoPlayer.js index b27e6c4f..2404f5c8 100644 --- a/source/Ox.UI/js/Video/Ox.VideoPlayer.js +++ b/source/Ox.UI/js/Video/Ox.VideoPlayer.js @@ -191,7 +191,7 @@ Ox.VideoPlayer = function(options, self) { key_0: toggleMuted, key_1: toggleScale, key_equal: function() { - changeVolumeBy(0.1); + changeVolume(0.1); }, key_escape: hideControlMenus, key_f: focusFind, @@ -202,7 +202,7 @@ Ox.VideoPlayer = function(options, self) { setPosition(self.options.position - self.secondsPerFrame); }, key_minus: function() { - changeVolumeBy(-0.1); + changeVolume(-0.1); }, key_p: function() { playInToOut(); @@ -1091,7 +1091,7 @@ Ox.VideoPlayer = function(options, self) { self.$copyrightIcon[self.censored ? 'show' : 'hide'](); } - function changeVolumeBy(num) { + function changeVolume(num) { showVolume(); self.options.volume = Ox.limit(self.options.volume + num, 0, 1); setVolume(self.options.volume); @@ -2120,8 +2120,10 @@ Ox.VideoPlayer = function(options, self) { } function showVolume() { - !self.interfaceIsVisible && showControls(); - self.$volume && self.$volume.is(':hidden') && toggleVolume(); + if (self.$volume) { + !self.interfaceIsVisible && showControls(); + self.$volume.is(':hidden') && toggleVolume(); + } } function submitFindInput(value, hasPressedEnter) { @@ -2371,6 +2373,11 @@ Ox.VideoPlayer = function(options, self) { } }; + that.changeVolume = function(num) { + changeVolume(num); + return that; + }; + /*@ playInToOut play in to out () -> play in to out