The html <audio> element is used to define sounds such as music and other audio clips. It plays an audio file on a web page.
Currently there are three supported file format for HTML 5 audio tag.
The following table shows the attributes that are specific to the <audio> tag.
Attribute
Description
autoplay
This Boolean attribute specifies that the audio will automatically start playing as soon as it can do so without stopping to finish loading the data.
controls
If specified, the browsers will display controls to allow the user to control audio playback, such as play/pause, volume, etc.
loop
This Boolean attribute specifies that the audio will automatically start over again, upon reaching the end.
muted
This Boolean attribute specifies whether the audio will be initially silenced. The default value is false, meaning that the audio will be played.
preload
Provides a hint to the browser about whether to download of the audio itself or its metadata. The autoplay attribute can override this attribute, because if you want to automatically play a audio, the browser will obviously need to download it.
src
Specifies the location of the audio file. Alternatively, you can use the preferred source tag as it allows for multiple options.