Stack Overflow Asked by Pelirrojo on December 9, 2021
I’m working on MediaElements.js to play some videos with subtitles.
I’m trying to disable the seeking inside the videos without hiding the progress bar.
I tried to add an eventListener
based on seeked event but it fails and starts an infinite loop. I think this is related with the functions *rail.
This is my code (fails):
// event handler
mediaElement.addEventListener('seeked', function(e) {
mediaElement.setCurrentTime(0);
mediaElement.play();
}, true);
Does anyone know how can I do it?
Usually, you can cancel an event by calling event.stopPropagation()
and returning false from the event listener.
As long as the event listener is triggered before the actual seeking takes place, this should theoretically work:
mediaElement.addEventListener('seeked', function(e) {
e.stopPropagation();
return false;
}, true);
Answered by Andrew Ensley on December 9, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP