Video loop attribute

Definition and usage

loop Whether the video should restart from the beginning after it ends, as set by the attribute.

This attribute reflects video> loop attribute.

When set, it specifies that the video should restart from the beginning after it ends.

Example

Example 1

Set the video to loop play:

document.getElementById("myVideo").loop = true;

Try it yourself

Example 2

Determine whether the video should restart from the beginning after each playback is completed:

var x = document.getElementById("myVideo").loop;

Try it yourself

Syntax

Return loop attribute:

videoObject.loop

Set loop attribute:

videoObject.loop = true|false

Attribute value

Value Description
true|false

Specify whether the video should restart from the beginning at the end of each playback.

  • true - Indicates that the video should restart after playing
  • false - Default. Indicates that the video should not restart after playing

Technical Details

Return Value: Boolean value, returns true if the video restarts at the end of each play; otherwise returns false.
Default Value: false

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 9.0 Support Support Support

Related Pages

HTML Reference Manual:HTML <video> loop Attribute