How do we embed audio in web pages in HTML5?


Use the <audio> tag to embed audio in a web page in HTML5. You can try to run the following code to implement <audio> tag −

Example

<!DOCTYPE html>
<html>
   <head>
      <title>HTML audio Tag</title>
   </head>
   <body>
      <p>Click on Play button...</p>
      <p>(Song: Kalimba which is provided as a Sample Music in Windows)</p>
      <audio controls>
         <source src = "/html/Kalimba.mp3" type = "audio/mpeg">
      </audio>
   </body>
</html>

Updated on: 03-Mar-2020

309 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements