From 52b1ba03f401d062d8fe417dd82b4ecbc7dc58cb Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sat, 22 Sep 2018 19:01:59 +0200 Subject: [PATCH] add chevron hotkeys to change playback rate --- client/src/assets/player/peertube-player.ts | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts index eca2ce6c3..5cea69eb8 100644 --- a/client/src/assets/player/peertube-player.ts +++ b/client/src/assets/player/peertube-player.ts @@ -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) + } + } + } } }) } -- 2.25.1