最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Autoplay iframe YouTube video in Safari 11 - Stack Overflow

programmeradmin1浏览0评论

I have a simple modal dialog:

  • User clicks on button.
  • Modal overlay shows.
  • YouTube <iframe> element is added.

All is good in most browsers - video starts playing, except Safari 11.1.

Safari has new auto-play policy that requires explicit click and video element to start playing it: /

Is there some way to make it autoplay for dynamically added YouTube (or Vimeo) iframe?

Example YouTube iframe:

<iframe frameborder="0" allowfullscreen="" allow="autoplay; encrypted-media; fullscreen" src=";amp;controls=0&amp;showinfo=0&amp;autoplay=1&amp;enablejsapi=1"></iframe>

I have a simple modal dialog:

  • User clicks on button.
  • Modal overlay shows.
  • YouTube <iframe> element is added.

All is good in most browsers - video starts playing, except Safari 11.1.

Safari has new auto-play policy that requires explicit click and video element to start playing it: https://webkit/blog/7734/auto-play-policy-changes-for-macos/

Is there some way to make it autoplay for dynamically added YouTube (or Vimeo) iframe?

Example YouTube iframe:

<iframe frameborder="0" allowfullscreen="" allow="autoplay; encrypted-media; fullscreen" src="https://www.youtube-nocookie./embed/20iMzRklHNU?rel=0&amp;controls=0&amp;showinfo=0&amp;autoplay=1&amp;enablejsapi=1"></iframe>
Share Improve this question asked Jul 9, 2018 at 23:25 Marvin3Marvin3 6,0518 gold badges38 silver badges48 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

Safari 11 now disables/blocks autoplay features. You have to manually go to the safari settings and Allow All Auto-Play.

发布评论

评论列表(0)

  1. 暂无评论