How to play infinitely looping video on-load in HTML5?

Spread the love

Sometimes, we want to play infinitely looping video on-load in HTML5

In this article, we’ll look at how to play infinitely looping video on-load in HTML5.

How to play infinitely looping video on-load in HTML5?

To play infinitely looping video on-load in HTML5, we add the loop attribute.

For instance, we write

<video width="320" height="240" autoplay loop muted>
  <source src="movie.mp4" type="video/mp4" />
  <source src="movie.ogg" type="video/ogg" />
  Your browser does not support the video tag.
</video>

to add the loop attribute to the video element to make the video loop forever.

Conclusion

To play infinitely looping video on-load in HTML5, we add the loop attribute.

Leave a Reply

Your email address will not be published. Required fields are marked *