Open In App

HTML <audio> autoplay Attribute

The HTML <audio> autoplay attribute is used to specify that the audio should automatically start playing as soon as it is loaded. It is a Boolean attribute. 

Note: Autoplay is not allowed in most cases on Chromium browsers. However, it is allowed when muted.



Syntax: 

<audio autoplay>

Example: This example illustrates the <audio> autoplay attribute in HTML 




<!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=
                type="audio/mpeg">
    </audio>
</body>
 
</html>

Output:



 Supported Browsers:

Article Tags :