Open In App

HTML <audio> autoplay Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

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 

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:

gty Supported Browsers:

  • Google Chrome 4
  • Edge 9
  • Firefox 3.5
  • Safari 4
  • Opera 11.5

Last Updated : 30 Jan, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads