R Gao
R Gao

Reputation: 19

My video header wont't play when the page loads

I have a video in my header, however, it will only play once you click on the home link in the menu to go to the /index.html. It will not play when the page first loads. I have also tested to see if manually entering /index.html at the end of the url works, it does not. The code I am using to play the video is:

<video autoplay loop>
    <source type="video/mp4" src="images/untitled.mp4" />
    <source type="video/webm" src="images/untitled.webm" />
</video>

And my website is http://richardgao.5gbfree.com (source code can be checked)

How do I get the video to play automatically when I first load the page?

Thanks

Upvotes: 0

Views: 440

Answers (1)

Lammi
Lammi

Reputation: 77

have you tested it in chrome? for chrome you need to switch off sound:

<video autoplay muted loop> ... </video>

and at least on some versions of safari autoplay doesn't work at all. you might start your vid using jquery, something like:

<video id="video" ...> ... </video>

$(document).ready() {
    $('#video').play();
}

Upvotes: 1

Related Questions