javascriptangulartypescriptvideoautoplay

Angular HTML Fullscreen Video Autoplay Not Working


Can anyone explain why this autoplay video is not working in chrome?

The video is stored in firebase storage. It plays when you visit a page and then go back to home page, but not when you first enter the page on refresh. It is an angular 6 application as well.

  <video autoplay muted loop>
    <source type="video/mp4" src="https://firebasestorage.googleapis.com/v0/b/gortonluxury.appspot.com/o/videos%2Fhero-video.mp4?alt=media&token=1231bda8-4240-4c1d-a0b9-9c5b50b320d0">
  </video>

Solution

  • <video loop muted autoplay oncanplay="this.play()" onloadedmetadata="this.muted = true">
        <source src="video.mp4" type="video/mp4">
    </video>
    

    Using onloadedmetadata & `oncanplay="this.play()"< are the javascript solutions to getting it to load on an Angular 6 project.