NEW 256075
WKWebView configuration mediaTypesRequiringUserActionForPlayback not working after iOS 16.3.1 update
https://bugs.webkit.org/show_bug.cgi?id=256075
Summary WKWebView configuration mediaTypesRequiringUserActionForPlayback not working ...
vaibhav garg
Reported 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.
Attachments
vaibhav garg
Comment 1 2023-04-27 22:24:06 PDT
Factory resetting the device fixes the issue, solution this extreme is not desirable
Alexey Proskuryakov
Comment 2 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?
Radar WebKit Bug Importer
Comment 3 2023-04-28 08:14:42 PDT
Eric Carlson
Comment 4 2023-04-28 08:55:59 PDT
`configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone` is used successfully in many WebKit API tests
vaibhav garg
Comment 5 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
Jer Noble
Comment 6 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?
vaibhav garg
Comment 7 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
Note You need to log in before you can comment on or make changes to this bug.