Some videos on the web play automatically, how can I get my video to play automatically?


Some embedded videos on the web play automatically, how can I get my embedded video to play automatically?


To get a video element to play automatically on page load, we can add the autoplay attribute to the opening <video> tag, like this:

<video width="320" height="240" autoplay> 
  <source src="" type="video/mp4"> 

A couple things to note:

  1. Some browsers disable autoplay, in which case a user would have to change their settings to allow autoplay.
  2. If you decide to use the autoplay attribute specifically with a video source that has an audio track, also consider adding the muted attribute for a better user experiece.
1 Like

Yeah, smart answer to a smart question.
I am so enjoying this.
Thanks a mill!

(Edit: I figured it out lol)

Thank you. Can you please specify how to add the muted attribute please?

I’m guessing it would be;

<video width ="320" height ="240" autoplay muted> Maybe? ```

1 Like

I figered out how to do it:

<video width="320" height="240" muted autoplay controls>

You forgot to put controls in your code.

Hoped this helps :smiley:


You’re a genius! It worked! Thank you. :cowboy_hat_face:

1 Like