HTML video Tag autoplay Attribute Tutorial

In this section, we will learn what the autoplay attribute is and how to use it.

What is autoplay Attribute in HTML <video> Tag?

When adding a video to a webpage via HTML < video> tag, you have the option to choose whether the video should play automatically after loading or it should wait for users to hit the play button first.

This is done with the help of autoplay attribute.

If we put this attribute to < video> element, browsers will play the video file automatically without the need of users to hit the play button first.

HTML autoplay Attribute in <video> Tag Syntax:

<video autoplay> </video>

<video> Tag autoplay Attribute Values

This attribute does not take a value! Simply put, the attribute in the opening tag of HTML <video> and that’s it, the video will be automatically played.

Example: using autoplay attribute in HTML <video> tag

See the Pen using autoplay attribute in HTML <video> tag by Omid Dehghan (@odehghan) on CodePen.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies