Youtube embedded video autoplay

落花浮王杯 提交于 2019-12-08 13:35:38

问题


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

this is a latest code youtube provides


回答1:


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.

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>



回答2:


I added mute=2 and the video autoplayed with sound.



来源:https://stackoverflow.com/questions/51230411/youtube-embedded-video-autoplay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!