Video auto play is not working in Safari and Chrome desktop browser

The best fix I could get was adding this code just after the </video>

<script>
    document.getElementById('vid').play();
</script>

…not pretty but somehow works.

UPDATE Recently many browsers can only autoplay the videos with sound off, so you’ll need to add muted attribute to the video tag too

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

Leave a Comment