Workaround for <video> loop attribute in Firefox

Does anyone know of a workaround (JavaScript, I would have guessed) for cyclizing HTML5 <video> elements in Firefox. The loop attribute is currently not supported in Firefox.

+2
source share
4 answers

You do not have a video to test, but found a solution on the Firefox support forums using jQuery, which you can try:

 $("#yourID").bind('ended', function(){ this.play(); }); 

http://support.mozilla.com/en-US/questions/747220

+1
source

Please do not abuse jQuery like this! You don’t need a huge library to link a simple listener! Use this:

  document.getElementById('video').addEventListener("ended", function(){this.play();}); 

If you find this helpful please vote!

This code runs when the video ends. Then an anonymous function will be launched. "this" refers to a video element through which we perform a playback function when the video is repeatedly played.

Shame on Firefox for not spreading this error for so long!

+5
source

The jQuery workaround laid out on the Mozilla website worked for me ( http://support.mozilla.com/en-US/questions/747220 ):

 $("#yourID").bind('ended', function(){ this.play(); }); 
+1
source

None of the answers here worked for me with Firefox on OS X.

My solution was to add loop = "loop" to the video tag. Lowering the loop = "loop" caused the video to not loop.

 <video src="myvid.mp4" loop="loop"></video> 
+1
source

Source: https://habr.com/ru/post/1416035/