Youtube iframe api allow=“autoplay” Chrome 65

拟墨画扇 提交于 2019-12-23 07:46:10

问题


Chrome 65, the current canary version, is blocking iframed youtube videos from auto playing with sound.

The latest changes to Chrome require the iframe to have allow="autoplay"

How do I go about adding allow="autoplay" to the youtube iframe api? I can't find it in any of the documentation.

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

A feature policy allows developers to selectively enable and disable use of various browser features and APIs. Once an origin has received autoplay permission, it can delegate that permission to cross-origin iframes with a new feature policy for autoplay. Note that autoplay is allowed by default on same-origin iframes.

<iframe src="myvideo.html" allow="autoplay">

回答1:


The YouTube IFrame API has been recently updated to use allow=autoplay instead of gesture=media. It should now work as expected.

Sorry for the confusion.




回答2:


You just add it in the src URL like:

autoplay

This parameter specifies whether the initial video will automatically start to play when the player loads. Supported values are 0 or 1. The default value is 0.



来源:https://stackoverflow.com/questions/48086769/youtube-iframe-api-allow-autoplay-chrome-65

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