Chrome视频自动播放 [英] Chrome video autoplay
本文介绍了Chrome视频自动播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
继Chrome&不再支持Firefox的最新更新自动播放视频-我尝试添加一些代码以在启动时播放此视频,但似乎不起作用?
Following Chrome & Firefox's recent update autoplay videos are no longer supported - I've tried to add some code to play this on startup but it doesn't seem to work?
var vid = document.getElementById("attractor");
function playVid() {
vid.play();
}
有人找到解决方法吗?
我们进行了大量的触摸屏互动,并且依靠这种方法制作吸引人的视频.
We do a lot of touch-screen interactives and rely on this method for our attractor videos.
推荐答案
自动播放仅在默认情况下将其指定为 muted 时才有效.
autoplay will only work if you specify it as muted by default, like this.
<video autoplay muted>
<source src="video.mp4" type="video/mp4"></source>
</video>
请放心,用户可以将视频取消静音,并将其作为html5视频元素的一部分.
Don't worry, users will be able to unmute the video as part of the html5 video element.
这篇关于Chrome视频自动播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文