Advertisement
Home Open Editor ❯

HTML autoplay Attribute

Example

<video width="340" height="260" controls autoplay="autoplay">
  <source src="demo/video.mp4" type="video/mp4">
  <source src="demo/video.webm" type="video/webm">
  Your browser does not support the video tag.
</video>

Try this code ❯

Meaning

This attribute indicates the browser should playing the audio/video as soon as after page load once it has loaded enough of the audio/video to avoid buffering.

Note: Some browsers do not allow autoplay in most of the cases. However, muted autoplay is always allowed.


Standard Syntax

HTML: <element autoplay>
XHTML: <element autoplay="autoplay">


Applies to:

The autoplay attribute can be used on the following element:

Element Attribute
<audio> autoplay
<video> autoplay

Advertisement

Attribute Values

Value Description
autoplay This is a boolean attribute, the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.
Home Open Editor ❯
Advertisement