I am trying to keep a video as the background of my Angular 5 app. But, when the page is loaded for the first time, the video is not playing.But If i go to any other page, and then again come back to home page, then the video is playing.
Till now i have tried these all
1.
<video id="v-control" width="100%" autoplay="" loop="" tabindex="0">
<source type="video/mp4" src="assets/img/MyVideo.mp4" alt=" MyVideo" />
<source type="video/webm" src="assets/img/MyVideo.webm" alt=" MyVideo" />
</video>
2. Jquery plugin for background video
<div data-vide-bg="MyVideo">
<video id="v-control" width="100%" autoplay="" loop="" tabindex="0">
<source type="video/mp4" src="assets/img/MyVideo.mp4" alt=" MyVideo" />
<source type="video/webm" src="assets/img/MyVideo.webm" alt=" MyVideo" />
</video>
</div>
and included
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="src/jquery.vide.js"></script>
in index.html
Still i am facing the same issue. Can anyone help , where am i doing wrong?
Try using onloadedmetadata="this.muted=true" within video tag as below, Hope this helps:
<video onloadedmetadata="this.muted=true" autoplay loop preload="auto">
<source src="Video_url" type="video/mp4">
</video>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With