Keyboard shortcuts do not trigger early-listeners
Author: guruprasCreated Feb 15, 2019Updated May 29, 2026
I use the early-listeners extensively for synchronizing playback. The keyboard shortcuts don't seem to be calling my listeners at all.
Expected behaviour
Keyboard shortcuts should trigger the early-listeners and use their return value to decide whether to invoke the default handler.
Actual behaviour
Keyboard shortcuts bypass the early-listeners. Strangely, spacebar alone seems to work under certain circumstances.
Steps to reproduce
function logEvent (msg) {
console.log(msg)
}
const plyr = new Plyr('video', {
listeners: {
play () {
const msg = `Triggered play: playing=${!plyr.playing}`
logEvent(msg)
return true
},
seek () {
const msg = `Triggered seek`
logEvent(msg)
return true
}
}
})Now, use keyboard shortcuts to control the video playback. If the early-listeners were being triggered, you should see console logs.
Environment
- Browser: Chrome
- Version: 72.0.3626.96 (Official Build) (64-bit)
- Operating System: Linux
- Version: Ubuntu 18.04
Console errors (if any)
Link to where the bug is happening
Here's a pen describing the issue.
Source: sampotts/plyr