Latest web development tutorials

HTML <audio> autoplay attribute

HTML audio tag Reference Manual HTML <audio> tag

Examples

Set to automatically play audio elements:

<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>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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

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


Definition and Usage

autoplay attribute specifies when audio is ready to start playing immediately.

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


HTML 4.01 and HTML 5 differences between

autoplay attribute is HTML 5 new property.


The difference between HTML and XHTML

In XHTML, this property is not allowed shorthand, autoplay attribute must be defined as <audio autoplay = "autoplay">.


grammar

<audio autoplay>


HTML audio tag Reference Manual HTML <audio> tag