HTML <audio> autoplay eigenschap
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).
Note:In most cases, Chromium browsers do not allow automatic playback. However, silent automatic playback is always allowed.
Tip:Please in autoplay
then add muted, so that your audio file starts playing automatically (but muted).
Example
The audio file that 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 tag. </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 |