Bug 243727

Summary: Web Audio API in WKWebView permanently muted after incoming call
Product: WebKit Reporter: Ashley Gullen <ashley>
Component: Web AudioAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: cdumez, eric.carlson, jer.noble, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Unspecified   
OS: Unspecified   

Ashley Gullen
Reported 2022-08-09 07:35:26 PDT
When using the Web Audio API in WKWebView, if the device receives an incoming call, it permanently mutes the AudioContext. This appears to be unrecoverable and the app has no way to restore audio playback. The AudioContext state is left as "running" but no audio output can be heard. The issue does not appear to affect the Safari browser, which can correctly play audio after an incoming call; it only seems to affect content in WKWebView in an app. However this covers all content made with frameworks like Cordova. It causes customer complaints for our software Construct (www.construct.net) which uses Cordova, e.g.: https://github.com/Scirra/Construct-3-bugs/issues/5954 It is sufficient to call the device and hear the ringtone, and then hang up. There is no need to actually accept the call to reproduce the issue, merely receiving a call and declining will cause all audio output from WKWebView to stop. Tested on an iPhone XS Max running iOS 15.6. I can provide a repro case using a full Cordova app, but I'm not sure how to prepare a minimal repro for WKWebView not using a framework like Cordova. I think that merely running any Web Audio sample in WKWebView and then calling the device ought to reproduce the issue. I can try to provide a minimal repro if you can advise on how to provide a minimal test case for WKWebView.
Attachments
Radar WebKit Bug Importer
Comment 1 2022-08-16 07:36:15 PDT
youenn fablet
Comment 2 2022-08-16 08:04:11 PDT
I just tried using http://webaudioapi.com/samples/oscillator/ using WKWebView in https://apps.apple.com/us/app/webview-wkwebview-and-uiwebview-rendering/id928647773. What I did was: 1. load http://webaudioapi.com/samples/oscillator/ using WebView 2. Start web audio to play some audio 3. Trigger a phone call and accept it (or deny it) 4. Verify that web audio restarts at the end of the phone call. It seems to work fine for me on the latest iOS 16 beta. I did not test on 15.6 though. @Ashley, can you have a try?
Note You need to log in before you can comment on or make changes to this bug.