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Â
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:
- Google Chrome 4
- Edge 9
- Firefox 3.5
- Safari 4
- Opera 11.5
Last Updated :
30 Jan, 2024
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...