7

I have simple ViewController with WKWebView configured as follows:

webView.configuration.allowsInlineMediaPlayback = true
webView.configuration.mediaTypesRequiringUserActionForPlayback = .video

But right after loading a web page with YouTube video it starts to play automatically (and switching to full screen at the same time) without any user interaction which is required. How to disable autoplay?

a-a-m
  • 96
  • 1
  • 5
  • Note that, that property is only available from iOS10. For previous versions you should set configuration.requiresUserActionForMediaPlayback = true – Carien van Zyl Sep 22 '17 at 11:50
  • Thanks, I've tried on latest stable version iOS 11.0 and seems like that flag ignored for YouTube pages. – a-a-m Sep 22 '17 at 12:06

1 Answers1

6

I also had same problem,YouTube vide was playing in full screen

webview.configuration.allowsInlineMediaPlayback = true

programmatically setting allowsInlineMediaPlayback value didn't work for me

You can avoid video switching fullscreen by enable inline playback for WKWebview. enter image description here

Kishor
  • 234
  • 4
  • 13