HTML Audio
HTML Audio
TThe HTML <audio> element is used to play an audio file on a web page.The controls attribute adds audio controls, like play, pause, and volume.
It is a good idea to always include width and height attributes. If height and width are not set, the page might flicker while the video loads. The <source> element allows you to specify alternative video files which the browser may choose from.
<audio width="320" height="240" controls>
<source src="sample.mp3" type="audio/mp3">
Your browser does not support the audio tag.
</audio>
HHTML <audio> Autoplay
To start a video automatically, use the autoplay attribute. Add muted after autoplay to let your video start playing automatically (but muted):
<audio width="320" height="240" autoplay muted>
<source src="sample.mp3" type="audio/mp3">
Your browser does not support the audio tag.
</audio>
Audio Format:
list use the attribute type to help define the type of list item maker.
- MP3: this format is in audio/mpeg
- Wav: this format is in audio/wav
- Ogg: this format is in audio/ogg