iOS 17 WKWebView does not play inline

WKWebview does not play inline even if wkwebview configuration allowsInlineMediaPlayback is set to true. Also the video has proper tags

<video loop playsinline preload="auto" autoplay src="https://test.io/demo.mp4" disableremoteplayback disablepictureinpicture></video>

This is only happening on iOS 17+ devices.

Found the same issue

Have the same issue. App uses cordova + ionic + angular + videogular, all videos are loaded locally. Installing the app and rebooting the device fixes the bug for some time. However, after using the app for some time, the bug eventually triggers and stays until the next device reboot.

What really puzzles me is that it seems to depend on the device itself:

  • iPhone 12 Mini with iOS 17.1 affected by the bug
  • iPhone 15 Pro max with iOS 17.1 not affected
  • iOS 16.3.x also affected
  • everything before and including iOS 16.2 not affected

Have the same issue, and have resolved. Here is my workaround: I am using objc to develop native app, without any third-party framework(react/flutter). I have tried these two config:

myWkWebView.configuration.allowsInlineMediaPlayback = NO;
myWkWebView.configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll;

but it is not work.

Then, I figure out what the problem is. You need to set the configuration before initialize the WkWebview instance:

WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];

config.allowsInlineMediaPlayback = YES;
config.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll;

id myWkWebView = [[WKWebView alloc] initWithFrame:CGRectMake(someX, someY, someWidth, someHeight) configuration:config];
iOS 17 WKWebView does not play inline
 
 
Q