diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-24 17:44:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-24 17:44:50 +0200 |
commit | 5363a766d95ed8654ad3e1b94538f085c2a3a101 (patch) | |
tree | 4bcbce6da8a3f99059821abc6e1cd80a739c183e /client | |
parent | 47d0b3ee611d1ae85c92149521619ebdf5f5cc25 (diff) | |
download | PeerTube-5363a766d95ed8654ad3e1b94538f085c2a3a101.tar.gz PeerTube-5363a766d95ed8654ad3e1b94538f085c2a3a101.tar.zst PeerTube-5363a766d95ed8654ad3e1b94538f085c2a3a101.zip |
Fix playback rate hotkey
Diffstat (limited to 'client')
-rw-r--r-- | client/src/assets/player/peertube-player.ts | 14 | ||||
-rw-r--r-- | client/src/assets/player/settings-menu-item.ts | 6 |
2 files changed, 11 insertions, 9 deletions
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts index 5cea69eb8..2c16c87ec 100644 --- a/client/src/assets/player/peertube-player.ts +++ b/client/src/assets/player/peertube-player.ts | |||
@@ -73,20 +73,18 @@ function getVideojsOptions (options: { | |||
73 | customKeys: { | 73 | customKeys: { |
74 | increasePlaybackRateKey: { | 74 | increasePlaybackRateKey: { |
75 | key: function (event) { | 75 | key: function (event) { |
76 | // use '>' | 76 | return event.key === '>' |
77 | return event.which === 51 | ||
78 | }, | 77 | }, |
79 | handler: function (player, options, event) { | 78 | handler: function (player) { |
80 | player.playbackRate(player.playbackRate() + 0.1) | 79 | player.playbackRate((player.playbackRate() + 0.1).toFixed(2)) |
81 | } | 80 | } |
82 | }, | 81 | }, |
83 | decreasePlaybackRateKey: { | 82 | decreasePlaybackRateKey: { |
84 | key: function (event) { | 83 | key: function (event) { |
85 | // use '<' | 84 | return event.key === '<' |
86 | return event.which === 50 | ||
87 | }, | 85 | }, |
88 | handler: function (player, options, event) { | 86 | handler: function (player) { |
89 | player.playbackRate(player.playbackRate() - 0.1) | 87 | player.playbackRate((player.playbackRate() - 0.1).toFixed(2)) |
90 | } | 88 | } |
91 | } | 89 | } |
92 | } | 90 | } |
diff --git a/client/src/assets/player/settings-menu-item.ts b/client/src/assets/player/settings-menu-item.ts index f6cf6d0f3..665ce6fc2 100644 --- a/client/src/assets/player/settings-menu-item.ts +++ b/client/src/assets/player/settings-menu-item.ts | |||
@@ -41,6 +41,10 @@ class SettingsMenuItem extends MenuItem { | |||
41 | // Voodoo magic for IOS | 41 | // Voodoo magic for IOS |
42 | setTimeout(() => { | 42 | setTimeout(() => { |
43 | this.build() | 43 | this.build() |
44 | |||
45 | // Update on rate change | ||
46 | player.on('ratechange', this.submenuClickHandler) | ||
47 | |||
44 | this.reset() | 48 | this.reset() |
45 | }, 0) | 49 | }, 0) |
46 | }) | 50 | }) |
@@ -60,7 +64,7 @@ class SettingsMenuItem extends MenuItem { | |||
60 | target = event.currentTarget | 64 | target = event.currentTarget |
61 | } | 65 | } |
62 | 66 | ||
63 | if (target.classList.contains('vjs-back-button')) { | 67 | if (target && target.classList.contains('vjs-back-button')) { |
64 | this.loadMainMenu() | 68 | this.loadMainMenu() |
65 | return | 69 | return |
66 | } | 70 | } |