Audio loop Property

❮ Audio Object

Example

Set the audio to loop:

document.getElementById("myAudio").loop = true;
Try it Yourself »

Description

The loop property sets or returns whether an audio should start playing over again when it is finished.

This property reflects the <audio> loop attribute.

When present, it specifies that the audio should start playing over again when it is finished.


Browser Support

Property
loop Yes Yes Yes Yes Yes

Syntax

Return the loop property:

audioObject.loop

Set the loop property:

audioObject.loop = true|false

Property Values

Value Description
true|false Specifies whether the audio should start playing over again, every time it is finished
  • true - Indicates that the audio should start playing again when it is finished
  • false - Default. Indicates that the audio should NOT start playing again when it is finished


Technical Details

Return Value: A Boolean, returns true if the audio starts playing over again, every time it is finished. Otherwise it returns false
Default Value: false

More Examples

Example

Find out if the audio should start playing over again every time it is finished, or not:

var x = document.getElementById("myAudio").loop;
Try it Yourself »

Related Pages

HTML reference: HTML <audio> loop attribute


❮ Audio Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.