Embed Audio HTML

Audio Tag in HTML:

Embed Audio HTML: Though it is possible to embed audio inside HTML, yet only HTML 5 supports this feature; however, various browsers respond differently to audio feature because there is no consensus among the modern day web browsers for audio format.  The tag <audio></audio> is used to render voice in HTML. There are a number of formats supported by this HTML tag that include: mp3, Ogg, WAV etc. In my experience, mp3 is the safest format with the major web browsers; therefore, I would advise you to use mp3 format. Let us try to add an audio file on a sample webpage:

Code for adding audio onto a webpage:

Step 1: Let us begin with by calling the HTML 5 document:


Step 2: Let us now place the actual code inside the body of our web document.Highlighted above is the code for defining your webpage as an html 5 document.


Play audio in HTML 5