HTML Audio


Go to main Page

Audio in HTML

To insert audio in an HTML document we use <audio></audio> element.

In audio tag, we have to use the <nontrol> attribute to control play, pause, and volume..

In the audio tag, we have to use the <source> attribute to provide the browser a source.

Example

<audio controls autoplay>
 
    <source src="sampleaudio.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
  </audio>
  

Add muted after autoplay to let your audio file start playing automatically (but muted):

<audio controls autoplay muted>
 
    <source src="sampleaudio.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
  </audio>