I have this code to play a video in a html5 page:
<video autoplay loop id="bgvid">
<source src="video-background.mp4" poster="/poster.png" type="video/mp4">
</video>
The problem is that it does not work in mobile chrome (Android Phone) and either in mobile safari (iPhone). But it works in "every" browser (tested with Safari, Chrome, Firefox) in desktop and also on mobile firefox (Android Phone).
How can I overcame this problem?
Edit: Added this code:
var myVideo = document.getElementById("bgvid");
function playVid() {
myVideo.play();
}
function pauseVid() {
myVideo.pause();
}
If I add a button that trigger the function playVid() it works. So I think the problem is on the autoplay. I tried to trigger the function with the load event but it does not works.