]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
add chevron hotkeys to change playback rate
authorRigel Kent <sendmemail@rigelk.eu>
Sat, 22 Sep 2018 17:01:59 +0000 (19:01 +0200)
committerRigel Kent <sendmemail@rigelk.eu>
Sat, 22 Sep 2018 17:01:59 +0000 (19:01 +0200)
client/src/assets/player/peertube-player.ts

index eca2ce6c39058ba860801c57d5e3fd52585eecd3..5cea69eb81e97e5089f8507221dfafa44f1b2f20 100644 (file)
@@ -69,7 +69,27 @@ function getVideojsOptions (options: {
     Object.assign(videojsOptions.plugins, {
       hotkeys: {
         enableVolumeScroll: false,
-        enableModifiersForNumbers: false
+        enableModifiersForNumbers: false,
+        customKeys: {
+          increasePlaybackRateKey: {
+            key: function (event) {
+              // use '>'
+              return event.which === 51
+            },
+            handler: function (player, options, event) {
+              player.playbackRate(player.playbackRate() + 0.1)
+            }
+          },
+          decreasePlaybackRateKey: {
+            key: function (event) {
+              // use '<'
+              return event.which === 50
+            },
+            handler: function (player, options, event) {
+              player.playbackRate(player.playbackRate() - 0.1)
+            }
+          }
+        }
       }
     })
   }