Video loopProperty

Video 对象参考手册Video Object

Examples

Set video to loop playback:

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

Try it Yourself »

Definition and Usage

The loop property sets or returns whether the video should start playing again when it ends.

This property reflects the <video> loop attribute.

When present, it specifies whether the video should start playing again after it ends.

Note:The <video> element is new in HTML5.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the loop property

Note:Internet Explorer 8 and earlier IE versions do not support the <video> element.


Syntax

Return the loop property:

videoObject.loop

Set the loop property:

videoObject.loop=true|false

Property Values

Value Description
true|false Specifies whether the video should start playing again after each play ends.
  • true - Indicates that the video should start playing again when it ends.
  • false - Default. Indicates that the video should not start playing again when it ends.

Technical Details

Return Value: A Boolean, returning true if the video starts playing again each time it ends, otherwise false.
Default Value: false


More Examples

Example

Check whether the video restarts after each playback ends:

var x = document.getElementById("myVideo").loop;
xThe result is:
true

Try it Yourself »


Related Pages

HTML Reference:HTML <video> loop Attribute


Video 对象参考手册Video Object Other Extensions