Bug 256075 - WKWebView configuration mediaTypesRequiringUserActionForPlayback not working after iOS 16.3.1 update
Summary: WKWebView configuration mediaTypesRequiringUserActionForPlayback not working ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: iPhone / iPad iOS 16
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-04-27 22:21 PDT by vaibhav garg
Modified: 2023-04-30 22:47 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vaibhav garg 2023-04-27 22:21:18 PDT
I am using WkWebView to display some dynamic content made in cocos creator game engine. For sound to play without user interaction I was using the "mediaTypesRequiringUserActionForPlayback" flag for WKWebViewConfiguration as '0' i.e. no user interaction is required to play audio/video.

The above setting was working fine and sound autoplay was working up untill iOS 16.0, after updating my iPad to iOS 16.3.1 the autoplay of sound stopped working. It can only be played if I call AudioContext.resume() on user interaction.

Can anyone advice how to get the audio autoplay working correctly again.
Comment 1 vaibhav garg 2023-04-27 22:24:06 PDT
Factory resetting the device fixes the issue, solution this extreme is not desirable
Comment 2 Alexey Proskuryakov 2023-04-28 08:14:27 PDT
Given that a factory reset has fixed this, not sure if there is strong evidence that this is a general regression. Have you observed this on multiple devices?
Comment 3 Radar WebKit Bug Importer 2023-04-28 08:14:42 PDT
<rdar://problem/108660861>
Comment 4 Eric Carlson 2023-04-28 08:55:59 PDT
`configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone` is used successfully in many WebKit API tests
Comment 5 vaibhav garg 2023-04-28 12:11:30 PDT
This configuration is being used by our app since a long time and was working fine till iOS 16.3.1 and I did receive this issue on multiple device including company and customer iPads
Comment 6 Jer Noble 2023-04-28 12:37:41 PDT
Can you verify that you're changing the value of `mediaTypesRequiringUserActionForPlayback` _before_ you call `-[WKWebView initWithFrame:configuration:]` and not after? Or better yet, give us a code snippet of your initialization logic?
Comment 7 vaibhav garg 2023-04-30 22:47:15 PDT
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
  [configuration setMediaTypesRequiringUserActionForPlayback:WKAudiovisualMediaTypeNone];
  
  WKWebView *webView = [[WKWebView alloc] initWithFrame:[Constants landscapeScreenFrame] configuration:configuration];


Hi, above is the exact objective c code that i am using for web view initialization