HTML Tutorial
Menu
HTML Forms
Menu
HTML Graphics
Menu
HTML Media
Menu
HTML API
Menu
HTML Audio
The HTML <audio> element plays an audio file on a web page.
The HTML <audio> Element
Using the <audio> element plays an audio file in HTML:
Example
Output:
HTML Audio – How It Works
- The controls attribute is used of adding the audio controls, like play, pause, and volume.
- The <source> element specifies alternative audio files from which the browser may choose. The browser recognizes the first format used.
HTML <audio> Autoplay
Using the autoplay attribute, starts an audi file automatically:
Example
HTML Audio – Methods, Properties, and Events
- The HTML DOM specifies methods, properties, and events for the <audio> element.
- It enables you to load, play, and pause audios, as well as set duration and volume.