HTML audio

Audio element is used to play audio files in the browser by full control of the user’s. Before third-party browser plug-ins such as Flash Player or QuickTime were used for this. Currently, audio element has additional child element named source. It is used to find out proper media file which you want to play. By this element, you can control start, stop and volume of the audio.

Audio formats:

Audio attributes:
SRC : Determine the source URL of Audio
Auto play: The audio file will play immediately after it loads.
Controls : Default audio controls are set of the browsers.
Loop: Audio can be loop that means the audio file will start over again when finished.
Preload: Audio will be loaded when the page loads. It has three values – none, metadata, auto.
None: Before of playback is anything.
Metadata: Load the metadata (such as length) of the audio before of playback.
Auto: Download audio completed as quickly as possible.

Use of <audio> elements:

You can insert the audio of web page by this element. Declare audio tag  and set source attribute with location of the audio file.

Syntax :

Multiple audio sources:

Audio file format is not supported by all browsers. So browser’s compatibility to ensure, should be used in audio format as much as possible. In that case both of the source and the embedded element can be used. Browser can detect the type of audio file by type attribute. For use with the type attribute audio files can be .audio/mp3/ogg.


One thought on “HTML audio

Leave a Reply

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