HTML audio tag

HTML audio tag

HTML audio tag is used to show audio resources in a web page.

HTML audio ‘src’ attribute is used to give the source of the audio file.


List of allowed HTML audio Formats

Sr. No.HTML audio available formatsDescription
1mp3Used to include mp3 extension files.
2oggUsed to include ogg extension files.
wavUsed to include wav extension files.


List of HTML audio attributes

Sr. No.HTML Audio AttributesDescription
1autoplayUsed to automatically play audio files. The values are boolean given by true and false.
2autobufferUsed to automatically download the audio file. This continues until the full audio file is downloaded.
3bufferedUsed to buffer the audio element.
4controlsUsed to give various controls to the include audio files. A user can handle the audio content playback, Volume, seeking and pause/resume playback system.
5loopUsed to make audio file to play again on seeking to the end. The value for this attribute are true and false.
6mozCurrentSampleOffsetUsed to give the number of samples from the beginning of the audio stream at which the audio is playing.
7mutedUsed to mute the audio file on play. This makes the audio silent without any sound.
8playedUsed to indicate all the ranges of the audio.
9preloadThis attribute has three values- auto, metadata and none. auto is used to play audio file once it gets loaded, none is used to make audio file not play automatically, metadata is used t obuffer the metadata of audio file.
10srcUsed to give the url of the audio resource file. The url can be full url as well as short url. A full url starts from http while the short url start starts from /.
11volumePlay volume in the range from 0 to 1(where 0 is for silent and 1 is for full volume.

Resources and References

1. W3C Specification.
2. HTML living standard
3. W3C project using Github

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.