Find out if the audio started to play as soon as it was ready:
The result of x will be:
The autoplay property sets or returns whether the audio should start playing as soon as it is loaded.
This property reflects the <audio> autoplay attribute.
When present, it specifies that the audio should automatically start playing as soon as it is loaded.
Note: The <audio> element is new in HTML5.
The autoplay property is supported in all major browsers.
Note: Internet Explorer 8 and earlier versions, do not support the <video> element.
Return the autoplay property:
Set the autoplay property:
Value | Description |
---|---|
true|false | Specifies whether an audio should automatically start playing as soon as
it is loaded
|
Return Value: | A Boolean, returns true if the audio automatically starts playing, otherwise it returns false |
---|---|
Default Value: | false |
Enable autoplay, and reload the video:
A demonstration of how to create a <video> element and setting the autoplay property:
HTML reference: HTML <audio> autoplay attribute