CSS Portal

HTML autoplay Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
autoplay
HTML AttributeThis attribute is supported by all modern browsers.
Updated 29th March 2024

Description

The HTML autoplay attribute is a boolean attribute that, when specified, indicates that the audio or video should start playing as soon as it is ready, without waiting for the entire file to download. It can be used on both <audio> and <video> tags. The primary use of autoplay is to provide a seamless media experience for the user by eliminating the need to manually start playback of a media file. However, its use is subject to various restrictions by browsers, primarily to improve user experience and prevent unexpected audio or video playbacks that could be intrusive. For example, many mobile browsers and some desktop browsers will ignore the autoplay attribute unless the video is muted, or unless the user has interacted with the site in some way. This is because automatic playback with sound can be disruptive or consume data on a mobile plan. To ensure compatibility and adherence to user preferences, developers often need to combine autoplay with other attributes like muted or use JavaScript to control media playback more dynamically.

Syntax

<tagname autoplay>

Values

The autoplay attribute is a boolean attribute, therefore no values are associated with this attribute.

Applies To

Example

<audio autoplay controls><source src="audio/chime.mp3" type="audio/mpeg">Sorry your browser does not support the audio tag.</audio>
<br>
<p>To see this attribute in action, please click on 'Editor'</p>
Open in editor

Browser Support

The following information will show you the current browser support for the HTML autoplay attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.

This attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee