add chevron hotkeys to change playback rate

pull/1111/head
Rigel Kent 2018-09-22 19:01:59 +02:00
parent 81cdf382ff
commit 52b1ba03f4
No known key found for this signature in database
GPG Key ID: EA12971B0E438F36
1 changed files with 21 additions and 1 deletions

View 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)
}
}
}
}
})
}