autoplay property

Gets or sets a value that indicates whether to start playing the media automatically.

 

Syntax

object.put_autoplay( autoplaystate);object.get_autoplay(* autoplaystate);

Property values

Type: VARIANT_BOOL

FALSE (false)

Default. The media is paused until play is called.

TRUE (true)

The media is played after it buffers enough data.

Standards information

Remarks

You can use the autoplay attribute rather than script to force the audio or video to play. The presence of the autoplay attribute, regardless of assigned value, in either the audio or video element equals true (for example, <audio autoplay> is true). Many developers use autoplay="autoplay" for readability.

To improve interoperability with other popular browsers, the autoplay property has no effect in Internet Explorer for Windows Phone 8.1 Update.

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> 

See also

autobuffer