Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Video loop Property

Video loop property

Video Object Reference The Video object

Example

Set the video to loop playback:

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

Try it »


Definition and Usage

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

This property reflects

When this attribute is present, it describes whether the video plays again after playback ends.

Note:


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the loop property

Note: Internet Explorer 8 and earlier IE versions do not support


Syntax

Return the loop attribute:

videoObject

.loop

Set the loop attribute:

videoObject

.loop=true|false

Attribute values

Value Description
true|false Describes whether the video plays again after each playback ends
  • true - Indicates that the video should play again when it ends.
  • false - Default. Indicates that the video should not play again when it ends.
  • |

    Technical Details

    Return Value: Boolean, returns true if the video replays after each playback ends, otherwise returns false.
    Default value: false

    More examples

    Example

    Check whether the video restarts playback after each playback ends:

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

    x

    The output is:

    true

    Try it »


    Related pages

    HTML Reference Manual: HTML


    Video Object Reference The Video object