Quick Links
HTML 5 Audio Tag specifies a standard for embedding audio in a web page. Currently there are three supported file for HTML audio tag.
i. mp3
ii. wav
iii. ogg
HTML5 supports <video> and <audio> controls.
HTML Audio Tag Example:
<audio controls>
<source src=”song.mp3″ type=”audio/mpeg”>
Your browser does not support the html audio tag.
</audio>
Attributes of HTML Audio Tag:
1. controls : It specifies that audio controls should be displayed (as: play/pause button).
2. autoplay : If it is defined then audio starts playing as soon as it is ready without asking for visitors.
3. loop : This attribute is used to have the audio replay every time it is finished.
HTML Audio Tag Attribute Example:
<audio controls autoplay loop>
<source src=”song.mp3″ type=”audio/mpeg”></audio>
MIME Types for HTML Audio format:
Audio Format | MIME Type |
mp3 | audio/mpeg |
ogg | audio/ogg |
wav | audio/wav |
Recommended Posts: