What is HTML autoplay Attribute?

HTML, HTML Attributes , 0 Comments

The autoplay attribute is a boolean attribute and it makes sure that the audio or video will play automatically as soon as possible without stopping.

Tag Support

You can use this attribute on audio and video HTML tags.

Audio Tag Example

<audio controls autoplay>
  <source src="dog.ogg" type="audio/ogg">
  <source src="dog.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

Video Tag Example

<video controls autoplay>
  <source src="myMovie.mp4" type="video/mp4">
  <source src="myMovie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

Browser Support

Element
audio 4.0 9.0 3.5 4.0 10.5
video 4.0 9.0 3.5 4.0 10.5

Leave a Reply

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