The loop
attribute on a media element specifies that the audio or video file will play repeatedly.
This will continue until stopped. Elements that accept this attribute include <audio>, and <video>.
A loop attribute on an <audio> element.
The audio will play over and over -- until it is stopped.
<audio controls loop>
<source src="/media/epic.mp3" type="audio/mpeg">
<source src="/media/epic.wav" type="audio/wav">
</audio>
For additional details see our HTML audio loop Reference.
The loop
attribute specifies that the audio or video file will play repeatedly.
When the audio or video reaches the end, it jumps to the start and play again.
<tagname loop>
The following elements accept the loop
attribute.
Elements | Description | |
---|---|---|
<audio> | Creates an audio player -- see example above | |
<video> | Creates a video player |
A <video> tag with an loop attribute.
The video will play over and over -- until it is stopped.
<video width="320" height="240" controls loop>
<source src="/media/movie.mp4" type="video/mp4">
<source src="/media/movie.ogg" type="video/ogg">
</video>
For additional details see our HTML video loop Reference.
Here is when loop
support started for each browser:
Chrome
|
4.0 | Jan 2010 |
Firefox
|
3.5 | Jun 2009 |
IE/Edge
|
9.0 | Mar 2011 |
Opera
|
11.5 | Aug 2011 |
Safari
|
4.0 | Jun 2009 |