Compartir a través de


loop property

Gets or sets a flag to specify whether playback should restart after it completes. Playback restarts when this flag is present on an element, or set to true on an object. Playback doesn't restart when this flag is absent from an element, or set to false on an object.

 

Syntax

object.put_loop(boolean

       loopFlag);object.get_loop(boolean

      * loopFlag);

Property values

Type: boolean

In a video or audio element, this attribute is true by its presence, false by its absence.

Standards information

Remarks

The presence of the loop attribute, regardless of assigned value, in either the audio or video element equals true (for example, <audio loop=""> is true).

Examples

This example has a simple video element with autoplay, controls, and loop attributes enabled. See the example online.

<!DOCTYPE html>
<html>
  <head>
    <title>Simple Video flags example</title>
      <!-- Uncomment the following tag when developing on a local or intranet computer -->
      <!-- <meta http-equiv='X-UA-Compatible' content="IE=edge" /> -->
</head>
<body>
  <h1>Simple video flags example</h1>
  <video controls="controls" autoplay="autoplay" loop="loop" >    
    <source src="http://ie.microsoft.com/testdrive/ieblog/2011/nov/pp4_blog_demo.mp4" />
    HTML5 video is not supported by this browser or mode
  </video>
   
</body>
</html>