Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 644
user10181542 Avatar asked Dec 13 '18 07:12

user10181542


Video Answer


1 Answers

<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.

like image 149
user10181542 Avatar answered Sep 17 '22 12:09

user10181542