The <audio> element embeds audio content into an HTML document. You specify the audio source using the src attribute.
<audio> |
Yes | 9.0 | Yes | Yes | Yes |
The <audio> tag is new in HTML5.
autoplay
makes audio start playing as soon as it is readyThe <audio> tag supports the Global Attributes in HTML.
The <audio> tag supports the Event Attributes in HTML.
None.
The following HTML code uses audio tag to include a mp3 format audio file into a HTML document
<!DOCTYPE HTML>
<html>
<body>
<audio controls src="mytrack.mp3" autoplay> Audio content
cannot be played
</audio>
</body>
</html>
The following examples show how to use the source element to provide multiple audio formats.
<!DOCTYPE HTML> <html> <body> <audio controls autoplay> <source src="mytrack.ogg" /> <source src="mytrack.mp3" /> <source src="mytrack.wav" /> Audio content cannot be played </audio> </body> </html>