Fix playback rate hotkey

pull/1118/head
Chocobozzz 2018-09-24 17:44:50 +02:00
parent 47d0b3ee61
commit 5363a766d9
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 11 additions and 9 deletions

View File

@ -73,20 +73,18 @@ function getVideojsOptions (options: {
customKeys: {
increasePlaybackRateKey: {
key: function (event) {
// use '>'
return event.which === 51
return event.key === '>'
},
handler: function (player, options, event) {
player.playbackRate(player.playbackRate() + 0.1)
handler: function (player) {
player.playbackRate((player.playbackRate() + 0.1).toFixed(2))
}
},
decreasePlaybackRateKey: {
key: function (event) {
// use '<'
return event.which === 50
return event.key === '<'
},
handler: function (player, options, event) {
player.playbackRate(player.playbackRate() - 0.1)
handler: function (player) {
player.playbackRate((player.playbackRate() - 0.1).toFixed(2))
}
}
}

View File

@ -41,6 +41,10 @@ class SettingsMenuItem extends MenuItem {
// Voodoo magic for IOS
setTimeout(() => {
this.build()
// Update on rate change
player.on('ratechange', this.submenuClickHandler)
this.reset()
}, 0)
})
@ -60,7 +64,7 @@ class SettingsMenuItem extends MenuItem {
target = event.currentTarget
}
if (target.classList.contains('vjs-back-button')) {
if (target && target.classList.contains('vjs-back-button')) {
this.loadMainMenu()
return
}