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

I have a simple modal dialog:User clicks on button.Modal overlay shows.YouTube <iframe> element

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745093441a4610831.html

相关推荐

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

    I have a simple modal dialog:User clicks on button.Modal overlay shows.YouTube <iframe> element

    15小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信