Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Video autoplay not working in Firefox

I have a website built with bootstrap and loading video in a dialog:

<video width="760" style="background-color: white;" preload controls autoplay>
    <source src="....." type="video/mp4" />
</video>

Shows and works fine in IE, Chrome and Safari. In Firefox auto play worked a few times, and now does not work at all. No errors in console and video plays just fine manually using controls.

I have also tried script approach (without autoplay attribute):

oncanplay="$(this)[0].play()"

And works flawlessly on all browsers except Firefox.

Can anyone see what could be wrong?

like image 878
Dusan Avatar asked Sep 15 '14 12:09

Dusan


1 Answers

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>
like image 50
Asad Ali Avatar answered Oct 20 '22 22:10

Asad Ali