The tag defines sound, such as music or other audio streams in a html page. The tag is used to embed audio content in an HTML document without requiring any additional plugins.
The supported audio formats in HTML are MP3, WAV, and OGG.
<audio id="welcome" controls> <source src="welcome.mp3" type="audio/mpeg"> </audio>
If the music in ogg, the type of source should be audio/ogg. In case of wav, it’s audio/wav.
const welcomeSong = document.querySelector("#welcome");
Play the audio
Pause the audio
Leave a Reply