ຄວາມສະເພາະ HTML <audio> autoplay
Definition and usage
autoplay
The attribute is a boolean attribute.
If this property is set, the audio will start playing automatically as soon as possible without stopping (as soon as the audio is ready, start playing immediately).
Note:In most cases, Chromium browsers do not allow automatic playback. However, always allow muted automatic playback.
Tip:Please in autoplay
then add muted, let your audio file start playing automatically (but muted).
Example
The audio file will start playing automatically:
<audio controls autoplay> <source src="horse.mp3" type="audio/mpeg"> <source src="horse.ogg" type="audio/ogg"> Your browser does not support the audio element. </audio>
Syntax
<audio autoplay>
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.5 | 4.0 | 11.5 |