The Audio autoplay property is used for setting or returning whether audio should start playing as soon as it is loaded or not.
It can be used to specify that the audio should automatically start playing as soon as it is loaded.
- Return the autoplay property:
- Set the autoplay property:
audioObject.autoplay = true|false
- true|false: It is used to specify whether an audio should automatically start playing as soon as it is loaded or not.
Below program illustrates the Audio autoplay Property:
Example: Enabling autoplay for an audio.
- Before clicking the button:
- After clicking the button:
Supported Browsers: The browser supported by HTML | DOM Audio autoplay Property are listed below:
- Google Chrome
- Internet Explorer
- Apple Safari