HTML <audio> autoplay attribute

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 (once the audio is ready, it will start playing immediately).

Note:In most cases, Chromium browsers do not allow automatic playback. However, silent automatic playback is always allowed.

Tip:Please autoplay added after muted, so that your audio file starts 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>

Try It Yourself

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