AllowsInlineMediaPlayback Not working


Anyone know why below code cannot prevent video automatically play on full screen? The WKWebView showing API content and the content has video advertising which always shown up in full screen mode I am trying to force it to play in line.

webView.configuration.allowsInlineMediaPlayback = true

but the video still automatically play in full screen mode.

Anyone know why the allowaInlineMediaPlayback not working? If you know the solution I would appreciate if you can share it with me. Many thanks!!

Kok Sing

Hi Kok Sing,

Try and add some more configuration like this:

 let webConfiguration = WKWebViewConfiguration()
        webConfiguration.allowsInlineMediaPlayback = true
        webConfiguration.mediaTypesRequiringUserActionForPlayback = []

        myPlayer = WKWebView(frame: CGRect(x: 0, y: 0, width: 375, height: 300), configuration: webConfiguration)

Let me now if that works for you.

Hi Mark,

Thanks. Yes, it works.

Kok Sing