plyr: Duplicate Events at window
Expected behaviour
A single ‘play’ event should be capture-able at the window when an HTML5 player is interacted with.
Actual behaviour
Plyr emits a duplicate CustomEvent with a special property pointing to the Plyr instance.
Environment
- Browser:
- Version:
- Operating System:
- Version:
Steps to reproduce
- Add a capturing listener
window.addEventListener('play', console.log, true); - Click the Play button
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 3
- Comments: 16 (5 by maintainers)
I’ll leave it open as a reminder
Oh, also, there’s an easy fix to check the event -
Event.isTrustedwill befalseif the Event is not natively triggered. That’s only useful for folks who are aware of the issue, though, and I’m concerned about those who aren’t.I’m not a big fan of the
listenersobject and my preference would be to just rely on events withevent.preventDefault()where required as this whole proxy thing is a pain to maintain. I’d also prefer to not have to catch and re-throw events but if I remove them, people whine and I think they have their uses 😃 The problem is the events on media elements such as<video>and<audio>don’t bubble by default so I have to catch and re-throw them…