HTML视频自动播放在Firefox中不起作用 [英] HTML Video autoplay not working in Firefox
问题描述
我有一个用引导程序构建的网站,并在对话框中加载视频:
< video width =760style =背景颜色:白色预加载控件自动播放>
< source src =.....type =video / mp4/>
< / video>在IE浏览器,Chrome浏览器和Safari浏览器中显示并正常运行。
在Firefox自动播放中工作了几次,现在根本不起作用。
在控制台和视频播放中没有任何错误,只需手动使用控件即可。
我也尝试了脚本方法(不带自动播放属性):
oncanplay =$(this)[0] .play()
除了Firefox以外,所有的浏览器都可以正常工作。
任何人都可以看到可能会出错的地方吗? $ b
解决方案问题有一个简单的解决方法:更改视频的顺序,首先列出。 mp4
来源和接下来的 .webm
来源自动播放视频在Firefox,资源管理器和Chrome上运行,这当然是有效的,如果你有多个视频源。
注意:Firefox在Windows 7和更高版本自21版以后支持 H.264
。如果安装了相应的 gstreamer
插件,则Firefox自版本26开始支持Linux上的 H.264
对Firefox的部分支持是指OSX&一些Linux平台,对于Android而言,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?
解决方案 The problem has an easy solution: changing the order of the videos, listing first the .mp4
source and next the .webm
source made the auto-play videos run on Firefox, Explorer and Chrome, this of course is valid if you have multiple video sources.
A side note: Firefox supports H.264
on Windows 7 and later since version 21. Firefox supports H.264
on Linux since version 26 if the appropriate gstreamer
plug-ins are installed. Partial support for Firefox refers to the lack of support in OSX & some Linux platforms, for Android Firefox it refers to the inability of hardware acceleration.
这篇关于HTML视频自动播放在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!