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;
Example 2
Determine whether the video should restart from the beginning after each playback is completed:
var x = document.getElementById("myVideo").loop;
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.
|
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