iframe - Youtube embedded video autoplay
问题描述
...not working. Any ideas why?
<iframe width="560" height="315" src="https://www.youtube.com/embed/nwe76N7J0EI?rel=0&controls=0&showinfo=0&start=1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
this is a latest code youtube provides
解决方案
默认情况下,它是浏览器阻止自动播放(带声音)。
https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
它终于在几个月前实施。您仍然可以使用自动播放,但需要将视频静音。
请注意下面嵌入中添加的 mute=1。它会自动播放,但如果你删除它就会中断。
<iframe width="560" height="315" src="https://www.youtube.com/embed/nwe76N7J0EI?rel=0&autoplay=1&mute=1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
推荐阅读
- log4j - 与地区无关的工作日名称?
- linux - Bash:排序命令不处理点
- javascript - 将一个对象存储在另一个对象中
- ios - mac mini 2013 年末,xcode 9.4.1 .. 我可以为当前的应用商店构建吗?
- javascript - 如果需要,将 jQuery 中的列表元素移动到正确的位置并创建子元素(通过移动其他元素)
- r - 计算多面体之间的重叠百分比(n 维)
- css - 如何将两个css类优化为一个
- c++ - 为什么在生成应用程序版本时显示错误消息
- google-cloud-platform - GCP CloudRun - 添加 NAT 网关或内部服务入口全部?
- reactjs - 如何从材质 ui 更改 Slider 的气泡头中显示的内容?