The tag in HTML is used to embed sound files β like songs, podcasts, background sound effects, or even voice messages β directly into your web page.
Basic syntax:
<audio controls>
<source src="music.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
Explanation:
I. <audio> β main tag.
II. controls β shows play, pause, and volume buttons.
III. <source> β tells the browser where the file is.
IV. Fallback text β shown if browser canβt play the file.
iv.<source> β Specifies the file and its format.
Fallback text β Appears if the browser doesnβt support video.
Now,let's implement the code to watch a video.
<video width="640" height="360" controls></video>
<source src="tajmahal.mp4 type="mp4">
Your browser doesnβt support video tag(Fallback text)
</video>