HTML audio tag
HTML <audio> tag embeds the audio or sound in a web page. src attribute defines the address of the audio.
<audio src="files/sample.mp3" controls> </audio>
</>
Tag Uses
Specific uses of <article> tagTag omission
Both starting and ending tags are necessary for the audio element.
Global Attributes
All the global attributes are applicable on the audio element.
multiple alternative audios
Some browsers don't support all types of media. Multitype audio resources are used so that if one is not supported the other one will be used.
<audio controls>
<source src="files/sample.mp3" type="audio/mp3" />
<source src="files/sample.ogg" type="audio/ogg" />
<p>Sorry, this media type can not be supported in this browser</p>
</audio>
Try</>
Here we have embedded two different types of audio.
Note: controls attribute must be used in the <audio> tag otherwise audio will not be played.
Next Previous
Was this article helpful?