HTML Audio

The HTML <audio > tag is used to is used to embed sound files into a web page. It plays by native support for audio playback built into the browser rather than a browser plugin.

Audio Breakdown

Here is the breakdown of HTML Audio.

Audio Attributes

Attribute Description
src It specifies the URL
autoplay It specifies that the audio will play automatically
controls It specifies that the audio controls get displayed
loop It specifies that the audio will start again every time after finish
muted It specifies that the audio should be muted
preload It specifies how and when the audio file should load

Audio Example

Below example will demonstrate the basic architecture of HTML Audio.

<!doctype html>  
<html>

    <head>
        <title>HTML Comment Example</title>
    </head>
  
    <body>
        <audio controls>
            <source src="myAudio.mp3" type="audio/mp3">
        </audio>
    </body>

</html>