HTML5 provides a standard for playing audio files.
Audio on the Web
Before the arrival of HTML5, there was no standard present inorder to play audio files on a web page.
Before the arrival of HTML5, audio files can be played with a help of a plug-in (like flash).
The HTML5 <audio> element has specified a standard method to embed audio in a web page.
The HTML <audio> Element
For playing an audio file in HTML, use the <audio> element:
HTML Audio - How It Works
The controls attribute is used to add audio controls, like play, pause, and volume.
Text between the <audio> and </audio> tags will be displayed in browsers which does not support the <audio> element.
Multiple <source> elements can be linked to different audio files. The browser will be using the first recognized format.
HTML Audio - Browser Support
At present, 3 file formats are supported for the <audio> element: MP3, Wav, and Ogg:
HTML Audio - Media Types
|File Format||Media Type|
HTML Audio - Methods, Properties, and Events
HTML5 is used to define DOM methods, properties, and events for the <audio> element.
This will allow you to load, play, and pause audios, and also set time duration and volume.
Other DOM events are also available which can notify you regarding the audio ie when it will begin to play, is paused, etc.
To have a look at full DOM reference, you can go to DOM Reference of our HTML5 Audio/Video.
HTML5 Audio Tags