Audio autoplay Property
Find out if the audio started to play as soon as it was ready:
The result of x will be:
Definition and Usage
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.
Return the autoplay property:
Set the autoplay property:
|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|
Enable autoplay, and reload the video:
x.autoplay = true;
A demonstration of how to create a <video> element and setting the autoplay property:
HTML reference: HTML <audio> autoplay attribute
❮ Audio Object