HTML Audio

HTML Audio:

The HTML <audio> element is used to play an audio file on a web page.

Example:

<audio controls>

    <source src=“myaudio.mp3” type=“audio/mpeg”>

    Your browser does not support the audio element.

  </audio>

 

 

Key attributes:

controls: Displays play/pause, volume, and other controls.

src: Specifies the audio file’s source.

type: Indicates the audio file’s MIME type (e.g., “audio/mpeg” for MP3).

Multiple sources compatiability:

Example:

<audio controls>

    <source src=“myaudio.mp3” type=“audio/mpeg”>

    <source src=“myaudio.ogg” type=“audio/ogg”>

    Your browser does not support the audio element.

 

  </audio>

Join Our Newsletter