HTML <audio>
query_builder | Christopher PisaniWith the HTML <audio> element, a small audio applet will be attached to the website, for audio playable content. It takes multiple audio sources, to be supported by different browsers and devices. Once the audio element is being parsed, the browser will choose the most suitable format to use from the <source>
<!--
The content inside the opening and closing <audio></audio> tags is shown as a fallback in browsers that don't support the element.
-->
<figure>
<figcaption>Listen to the T-Rex:</figcaption>
<audio controls src="https://interactive-examples.mdn.mozilla.net/media/examples/t-rex-roar.mp3">
Your browser does not support the
<code>audio</code> element.
</audio>
</figure>
Available Attributes
Attribute | Values | Functionality |
---|---|---|
src | url | Location of the source file |
autobuffer | The way the audio is loaded when the page is loaded | |
autoplay | Will start playing as soon as the file is loaded | |
loop | The audio will play in an infinitive loop | |
controls | Shows/hides the controls on the audio | |
preload | auto metadata none |
how audio is loaded into document |