Back to api.video Glossary

Autoplay

Autoplay

What is the autoplay attribute in HTML5?

Autoplay is an attribute commonly used in the HTML5 video tag. It tells the browser that the developers would like the video to play automatically when the webpage loads.

The actual implementation of autoplay is not as straightforward. We'll walk through the options in order of ease of implementation:

General autoplay settings

  • On mobile Chrome and Safari (and in most other browsers), videos will only autoplay when paired with the muted attribute. Of course, without audio, you might want to consider adding captions to your video.

  • If a user has interacted with video on your website in the past, videos with autoplay set will play automatically with audio. Each browser has different criteria to make this occur. This is can hard to test, since once you interact with the page - you'll see the video autoplay.

api.video autoplay settings

  • api.video player: You can set the 'force autoplay' attribute to true, and all videos viewed with this player will autoplay (they will be muted).

  • Player SDK: Setting the autoplay attribute will result in the video playing as soon ias it is loaded.

   player.loadConfig({
      id: "<VIDEO_ID>",
      id: "<VIDEO_ID>",
      autoplay: true,
      hideControls: true,
   });
  • api.video video: You can set the player to autoplay in the url by adding #autoplay to the end of the player url.

Related content

glossaryglossary