本文介绍了YouTube嵌入式视频自动播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

...不起作用.有什么想法吗?

...not working. Any ideas why?

<iframe width="560" height="315" src="https://www.youtube.com/embed/nwe76N7J0EI?rel=0&amp;controls=0&amp;showinfo=0&amp;start=1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

这是youtube提供的最新代码

this is a latest code youtube provides

推荐答案

默认情况下,这是浏览器阻止自动播放(带有声音)的功能.

It's the browser blocking autoplay(with sound) by default.

https://developers.google.com/web /updates/2017/09/autoplay-policy-changes

它终于在几个月前实施.您仍然可以使用自动播放功能,但是视频需要静音.

It was finally implemented a few months ago. You can still use autoplay, but the video will need to be muted.

请注意下面的嵌入中添加的静音= 1.它会自动播放,但是如果您将其删除,则会中断.

Notice the added mute=1 in the embed below. It will autoplay, but it breaks if you remove it.

<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>

这篇关于YouTube嵌入式视频自动播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-05 10:42