WKWebView on iOS 18: Video Auto-Play Not Working Inline, Launching in Full-Screen Instead

Hello,

I'm experiencing an issue with WKWebView in my iOS app when running on devices with iOS 18. Specifically, when auto-playing videos, they do not play inline as expected but instead switch to full-screen mode. This problem only occurs on iOS 18; in earlier versions, the videos played inline without any issues.

Here is the configuration I'm using for WKWebView:

let configuration: WKWebViewConfiguration = WKWebViewConfiguration.init()

configuration.allowsInlineMediaPlayback = true

configuration.mediaTypesRequiringUserActionForPlayback = []

Additionally, I have set the 'playsinline' attribute in the video tag on the web page.

Despite these settings, when the webpage initially loads, the video sometimes plays in full-screen mode rather than inline. I am looking for a solution to ensure that videos always play inline as intended on iOS 18.

Has anyone encountered a similar issue or know of any workarounds? Any help would be greatly appreciated!

Thank you!

WKWebView on iOS 18: Video Auto-Play Not Working Inline, Launching in Full-Screen Instead
 
 
Q