Disable seeking in mediaelement.js

I'm working on MediaElements.js to play some videos with subtitles.

I'm trying to disable the seeking inside the videos without hidding 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??

Thanks in advance

Answers


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);

Need Your Help

CSS - vendor prefixes don't validate

css css3 w3c-validation vendor-prefix

How am I supposed to achieve valid CSS3 on W3C's CSS validator if I use properties with vendor prefixes like -webkit-border-radius and -moz-box-shadow?

Cakephp Security.salt in wrong file by mistake

php security cakephp

I made a mistake when installing a previous Cakephp 2.3.4 in the Security.salt parameter.