Search code examples
androidhtmlfirefoxvideoautoplay

Is firefox mobile/firefox focus supposed to always autoplay videos?


I've added a video as a background (with the many tricks you can find), the video does autoplay on chrome mobile, on desktop, but not on firefox mobile and firefox focus. Is it something specific to mozilla? Is it a rule for mobile videos?

video#bgvid {
    position: fixed;
    right: 0; bottom: 0;
    min-width: 100%; min-height: 100%;
    width: auto; height: auto; z-index: -10;
    background-size: cover;
}


<script>
    window.onload = function(){
        document.getElementById('bgvid').play();
    }
</script>


<video id="bgvid" playsinline src="bg3.mp4" autoplay="autoplay" loop autoplay muted>
</video>

VLC video info, dimensions, codec, was compressed with AVIDemux


Solution

  • I have tested this on all browser its working perfect with javascript event

    <video onloadeddata="this.play();" poster="poster.png" playsinline loop muted controls>
        <source src="video.mp4" type="video/mp4" />
        <source src="video.mp4.webm" type="video/webm" />
        <source src="video.mp4.ogg" type="video/ogg" />
        Your browser does not support the video tag or the file format of this video.
    </video>