HTML Audio/Video DOM loop attribute

Example

Set the video to loop play:

myVid=document.getElementById("video1");
myVid.loop=true;

Try It Yourself

Definition and Usage

The loop attribute sets or returns whether the audio/video should be replayed at the end.

Browser Support

All major browsers support the loop attribute.

Note:Internet Explorer 8 or earlier browsers do not support this attribute.

Syntax

Set loop attribute:

audio|video.loop=true|false

Return loop attribute:

audio|video.loop

Attribute Value

Value Description
true Indicates that the audio/video should be replayed at the end.
false Default. Indicates that the audio/video should not be replayed at the end.

Return Value

Type Description
Boolean true|false. The default value is false.