English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Comprehensive List

HTML: <audio> autoplay property

The autoplay property is a boolean property, the autoplay property specifies that the audio should start playing as soon as it is ready. If this property is set, the audio will play automatically

HTML <audio> tag

Online Example

The audio file will start playing automatically:

!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>HTML:<audio> autoplay property-Basic Tutorial Website(oldtoolbag.com)</title> 
</head>
<body>
<audio controls autoplay>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Internet Explorer 9+, Firefox, Opera, Chrome, and Safari browsers support the autoplay attribute.

Note: Internet Explorer 8 and earlier versions do not support the <audio> tag.

Definition and Usage

The autoplay attribute is a boolean attribute

The autoplay attribute specifies that the audio should start playing as soon as it is ready.

If this attribute is set, the audio will play automatically.

HTML 4.01 and HTML 5 differences

The autoplay attribute is in HTML 5 new attributes.

Differences between HTML and XHTML

In XHTML, this attribute is not allowed to be abbreviated, the autoplay attribute must be defined as <audio autoplay="autoplay">.

Syntax

<audio autoplay>

HTML <audio> tag