begin to add some keyboard shortcuts to video view annotation panel

This commit is contained in:
rlx 2012-02-17 17:31:39 +00:00
parent ba0fe16a07
commit 5383867f70

View file

@ -61,9 +61,8 @@ Ox.VideoPanel = function(options, self) {
}) })
.bindEvent({ .bindEvent({
resize: resizeElement, resize: resizeElement,
key_space: function() { key_0: toggleMuted,
that.togglePlay(); key_space: togglePaused
}
}); });
self.fullscreen = false; self.fullscreen = false;
@ -153,6 +152,7 @@ Ox.VideoPanel = function(options, self) {
}) })
.css({left: '4px', top: '4px'}) .css({left: '4px', top: '4px'})
.bindEvent({ .bindEvent({
mousedown: that.gainFocus,
position: changeTimeline position: changeTimeline
}) })
.appendTo(self.$controls); .appendTo(self.$controls);
@ -233,6 +233,17 @@ 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'
].forEach(function(key) {
key = 'key_' + key;
self.$annotationPanel.bindEvent(key, function() {
that.triggerEvent(key);
});
});
that.$element = Ox.SplitPanel({ that.$element = Ox.SplitPanel({
elements: [ elements: [
{ {
@ -359,15 +370,22 @@ Ox.VideoPanel = function(options, self) {
}); });
} }
function toggleMuted() {
self.$video.toggleMuted();
}
function togglePaused() {
self.$video.togglePaused();
self.$video.options('paused') && that.triggerEvent('position', {
position: self.$video.options('position')
});
}
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'fullscreen') { if (key == 'fullscreen') {
self.$video.options({ self.$video.options({fullscreen: value});
fullscreen: value
});
} else if (key == 'height') { } else if (key == 'height') {
self.$video.options({ self.$video.options({height: getPlayerHeight()});
height: getPlayerHeight()
});
} else if (key == 'in' || key == 'out') { } else if (key == 'in' || key == 'out') {
setPoint(key, value); setPoint(key, value);
} else if (key == 'position') { } else if (key == 'position') {
@ -381,12 +399,8 @@ Ox.VideoPanel = function(options, self) {
} else if (key == 'showTimeline') { } else if (key == 'showTimeline') {
self.$videoPanel.toggle(1); self.$videoPanel.toggle(1);
} else if (key == 'width') { } else if (key == 'width') {
self.$video.options({ self.$video.options({width: getPlayerWidth()});
width: getPlayerWidth() self.$timeline.options({width: getTimelineWidth()});
});
self.$timeline.options({
width: getTimelineWidth()
});
} }
} }