google-chromeautoplay

Chrome video autoplay


Following Chrome & Firefox's recent update autoplay videos are no longer supported - I've tried to add some code to play this on startup but it doesn't seem to work?

    var vid = document.getElementById("attractor"); 

    function playVid() { 
        vid.play(); 
    } 

Has anyone found a workaround to this?

We do a lot of touch-screen interactives and rely on this method for our attractor videos.


Solution

  • autoplay will only work if you specify it as muted by default, like this.

        <video autoplay muted>
          <source src="video.mp4" type="video/mp4"></source>
       </video>
    

    Don't worry, users will be able to unmute the video as part of the html5 video element.