Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <video> autoplay Attribute

The autoplay attribute on a <video> tag specifies that the video starts playing once the page is loaded.

Without this attribute the user must start the video.

Example

#

An autoplay attribute on a <video> element. To avoid surprises, autoplay is disabled on this page. Click 'Try It live' to see it enabled.

<video width="320" autoplay>
  <source src="/media/movie.mp4" type="video/mp4">
  <source src="/media/movie.ogg" type="video/ogg">
</video>

Using autoplay

With this attribute, the video file will start playing even before the entire file is loaded.

Suddenly playing a video may startle users because they are not expecting it.

It is usually best to give users control over when to start.

Tip: Automatically playing a video may surprise users because they are not expecting it. It is better to give the users full control over when to start.


Syntax

<video autoplay>

Browser support

Here is when autoplay support started for each browser:

Chrome
4.0 Jan 2010
Firefox
3.5 Jun 2009
IE/Edge
9.0 Mar 2011
Opera
11.5 Aug 2011
Safari
3.1 Mar 2008

You may also like

 Back to <video>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides