Open In App

How to autoplay audio on chrome ?

Here we will learn how to auto-play audio on selected devices in web pages. To load the audio in the web page, we use the <audio> tag.

There are some attribute of this “audio” tag:



Example:




<!DOCTYPE html> 
<html
  
<head
    <title
        HTML audio autoplay Attribute 
    </title
</head
  
<body style="text-align: center"
  
    <h1 style="color: green"
        GeeksforGeeks 
    </h1
      
    <h2>HTML audio autoplay Attribute</h2
  
    <audio controls autoplay> 
        <source src="GFG.ogg" type="audio/ogg"
        <source src="GFG.mp3" type="audio/mpeg"
    </audio
</body
  
</html>

Output:



Article Tags :