<audio> tag in HTML
The <audio> tag is used to play supported audio files.
Chrome,firefox and opera browsers support .mp3,.wav and .ogg audio files.
Internet Explorer only support .mp3 files.
Safari browser doesn't support .ogg files.
MIME-Type
- .mp3 - audio/mpeg
- .wav - audio/wav
- .ogg - audio/ogg
autoplay and src attribute in <audio> tag
src attribute is used to give path of the audio file.
If you add autoplay attribute with the <audio> tag, the given audio file will play automatically when the web page finished loading.
controls attribute in <audio> tag
The controls attribute is used to show audio player controls like play, sound buttons.
muted attribute in <audio> tag
The muted attribute is used to mute the sound control.
loop attribute in <audio> tag
The loop attribute is used to play the given audio file repeatedly.