Fix playback rate hotkey
This commit is contained in:
parent
47d0b3ee61
commit
5363a766d9
|
@ -73,20 +73,18 @@ function getVideojsOptions (options: {
|
||||||
customKeys: {
|
customKeys: {
|
||||||
increasePlaybackRateKey: {
|
increasePlaybackRateKey: {
|
||||||
key: function (event) {
|
key: function (event) {
|
||||||
// use '>'
|
return event.key === '>'
|
||||||
return event.which === 51
|
|
||||||
},
|
},
|
||||||
handler: function (player, options, event) {
|
handler: function (player) {
|
||||||
player.playbackRate(player.playbackRate() + 0.1)
|
player.playbackRate((player.playbackRate() + 0.1).toFixed(2))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
decreasePlaybackRateKey: {
|
decreasePlaybackRateKey: {
|
||||||
key: function (event) {
|
key: function (event) {
|
||||||
// use '<'
|
return event.key === '<'
|
||||||
return event.which === 50
|
|
||||||
},
|
},
|
||||||
handler: function (player, options, event) {
|
handler: function (player) {
|
||||||
player.playbackRate(player.playbackRate() - 0.1)
|
player.playbackRate((player.playbackRate() - 0.1).toFixed(2))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,10 @@ class SettingsMenuItem extends MenuItem {
|
||||||
// Voodoo magic for IOS
|
// Voodoo magic for IOS
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.build()
|
this.build()
|
||||||
|
|
||||||
|
// Update on rate change
|
||||||
|
player.on('ratechange', this.submenuClickHandler)
|
||||||
|
|
||||||
this.reset()
|
this.reset()
|
||||||
}, 0)
|
}, 0)
|
||||||
})
|
})
|
||||||
|
@ -60,7 +64,7 @@ class SettingsMenuItem extends MenuItem {
|
||||||
target = event.currentTarget
|
target = event.currentTarget
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.classList.contains('vjs-back-button')) {
|
if (target && target.classList.contains('vjs-back-button')) {
|
||||||
this.loadMainMenu()
|
this.loadMainMenu()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue