davidjwest
davidjwest

Reputation: 546

Google Chrome Will Not Autoplay Video

So, I have this video autoplaying OK in Firefox and IE:

http://sweeneydogkr.co.uk/video.html

But no joy with Chrome, any ideas?

Code:

<video autoplay muted controls loop>
            <source src="images/sweeneydog.mp4" type="video/mp4">

Upvotes: 0

Views: 444

Answers (3)

user11168542
user11168542

Reputation: 21

new policies of chrome do not permit autoplay. Safari still works

Upvotes: 2

Sean Doherty
Sean Doherty

Reputation: 2378

Ended up here because I was having the same issue (no autoplay in Chrome despite it working in Firefox & Safari) @Csisanyi's solution didn't work for me - myVideo.play() actually threw a console error. This is what fixed it for me:

$('#video')[0].load();

Hopefully this may help somebody else.

Upvotes: 1

Csisanyi
Csisanyi

Reputation: 895

video tag seems correct, if i run it without the //DOM Ready part, it autoplays in chrome. With the script enabled it doesn't play.

Quick fix might be:

-add id(ex. myVideo) to your video tag in anythingSlider div.

-add the following function to the end of the page.

</body>
<script>
        var myVideo = document.getElementById("myVideo");
        setTimeout(() => {
            myVideo.play();
        }, 1000);
</script>
</html>

Upvotes: 1

Related Questions