autoplay attribute on a media player specifies that the element immediately starts playing the media file when the page is loaded. Elements that accept this attribute include <audio>, and <video>.
<audio autoplay controls> <source src="/media/epic.mp3" type="audio/mpeg"> <source src="/media/epic.wav" type="audio/wav"> </audio>
For additional details see our HTML audio autoplay Reference.
autoplay attribute specifies that the media player starts when the page is loaded.
With this attribute, the media file will start playing even before the entire file is loaded.
Tip: Automatically playing audio or video may surprise users because they are not expecting it.
It is better to give the users full control over when to start the audio or video.
These elements accept the
|<audio>||Creates an audio player -- see example above|
|<video>||Creates a video player|
<video width="320" autoplay> <source src="/media/movie.mp4" type="video/mp4"> <source src="/media/movie.ogg" type="video/ogg"> </video>
For additional details see our HTML video autoplay Reference.
Here is when
autoplay support started for each browser: