HTML | DOM Audio autoplay Property
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.
Return Values: It returns a Boolean value, that returns true if the audio automatically starts playing, otherwise it returns false
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 1 and above
- Edge 12 and above
- Internet Explorer 9 and above
- Firefox 3.5 and above
- Opera 12.1 and above
- Apple Safari 3.1 and above