Audio loopProperty
Example
Set the audio to loop playback:
document.getElementById("myAudio").loop = true;
Try it Yourself »
Definition and Usage
The loop property sets or returns whether the audio should play again when playback ends.
This property reflects the <audio> loop attribute.
When this property is used, the audio continues to play after playback ends.
Note:The <audio> element is new in HTML5.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the loop property.
Note:Internet Explorer 8 and earlier IE versions do not support this property.
Syntax
Return the loop property:
audioObject.loop
Set the loop property:
audioObject.loop=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Indicates whether the audio plays again when it ends.
|
Technical Details
| Return Value: | Boolean value, returns true if the audio loops, otherwise returns false. |
|---|---|
| Default Value: | false |
More Examples
Example
Check whether the audio plays again after it finishes playing:
var x = document.getElementById("myAudio").loop;
xThe output result is:
true
Try it Yourself »
Related Pages
HTML Reference Manual:HTML <audio> loop Attribute
Audio Object Other Extensions