make +/- volume keyboard shortcut work in video and timeline views

This commit is contained in:
rlx 2012-02-19 11:21:52 +00:00
parent 529184887a
commit 7d188d8621
5 changed files with 46 additions and 19 deletions

View file

@ -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() {

View file

@ -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() {

View file

@ -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() {

View file

@ -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() {

View file

@ -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 <f> play in to out
() -> <o> play in to out