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.

Syntax


List of allowed HTML audio Formats

Sr. No. HTML audio available formats Description
1 mp3 Used to include mp3 extension files.
2 ogg Used to include ogg extension files.
wav Used to include wav extension files.

Output



List of HTML audio attributes

Sr. No. HTML Audio Attributes Description
1 autoplay Used to automatically play audio files. The values are boolean given by true and false.
2 autobuffer Used to automatically download the audio file. This continues until the full audio file is downloaded.
3 buffered Used to buffer the audio element.
4 controls Used to give various controls to the include audio files. A user can handle the audio content playback, Volume, seeking and pause/resume playback system.
5 loop Used to make audio file to play again on seeking to the end. The value for this attribute are true and false.
6 mozCurrentSampleOffset Used to give the number of samples from the beginning of the audio stream at which the audio is playing.
7 muted Used to mute the audio file on play. This makes the audio silent without any sound.
8 played Used to indicate all the ranges of the audio.
9 preload This 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.
10 src Used 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 /.
11 volume Play 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.

ULTIMATE TOOLKIT Free eBook

Get FREE Access to Toolkit and Resources that we are using in Tutorialdeep that Every Professional Should Have! in one handy PDF.

Download Link Will be Send to Your Email id