summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-02-05 18:36:16 -0600
committerOmar Roth <omarroth@hotmail.com>2018-02-05 18:36:16 -0600
commitd3e159ffbe7a7a6e12fc78aea1ae67b989036b35 (patch)
tree52615648efcb16ab91c125c8015c6b57f6bdc8ef /src
parentd88b60979b3ed2388a4ae7144cc4787ac7839385 (diff)
downloadinvidious-d3e159ffbe7a7a6e12fc78aea1ae67b989036b35.tar.gz
invidious-d3e159ffbe7a7a6e12fc78aea1ae67b989036b35.tar.bz2
invidious-d3e159ffbe7a7a6e12fc78aea1ae67b989036b35.zip
Add youtube hotkeys
Diffstat (limited to 'src')
-rw-r--r--src/views/watch.ecr37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/views/watch.ecr b/src/views/watch.ecr
index 9f2bd31f..b3605394 100644
--- a/src/views/watch.ecr
+++ b/src/views/watch.ecr
@@ -34,7 +34,42 @@ var player = videojs('player', options, function() {
this.hotkeys({
volumeStep: 0.1,
seekStep: 5,
- enableModifiersForNumbers: false
+ enableModifiersForNumbers: false,
+ enableVolumeScroll: false,
+ customKeys: {
+ play: {
+ key: function(e) {
+ // Toggle play with K Key
+ return (e.which === 75);
+ },
+ handler: function(player, options, e) {
+ // Example
+ if (player.paused()) {
+ player.play();
+ } else {
+ player.pause();
+ }
+ }
+ },
+ backward: {
+ key: function(e) {
+ // Go backward 5 seconds
+ return (e.which === 74);
+ },
+ handler: function(player, options, e) {
+ player.currentTime(player.currentTime() - 5);
+ }
+ },
+ forward: {
+ key: function(e) {
+ // Go forward 5 seconds
+ return (e.which === 76);
+ },
+ handler: function(player, options, e) {
+ player.currentTime(player.currentTime() + 5);
+ }
+ }
+ }
});
});
</script>