Hello! Two big issues with the WebAudio implementation in WKWebView : 1. since iOS 16.3 (new bug!), WebAudio is muted when the silent switch on the side of the phone is ON 2. since iOS 15 (!!), WebAudio is muted when the app goes to background. It is a known bug but it has been mistakenly flagged as "resolved/closed" here : https://bugs.webkit.org/show_bug.cgi?id=237878 3. as a bonus : when the power saving mode is ON, the WebView performance drops too much (15 FPS), making the app not fully usable. Here is a DEMO VIDEO of the problems : https://www.youtube.com/watch?v=lpVfctVj8qE These 3 points don't happen with Native Swift apps, so it is very confusing for the users and I assume it is a mistake! For now it is impossible to make a serious/usable music app in the WebView... Can someone please seriously look at this for a quick fix? A big thanks!!
Let's track only issue #1 here, as the most recent regression. Please file separate reports about the other issues, as tracking them together reduces the chances of getting any fixed.
<rdar://problem/104987540>
The silent switch is silencing notifications so it might behave as expected. Using a MediaStreamAudioDestinationNode should probably fix 1, 2 and 3. It is probably a bit less efficient. We could think of changing our heuristics, but this might affect existing content. @Adrien, marking is as resolved invalid for now. Please reopen if needed.
I agree with Adrien that this is confusing because native apps are not silenced in this way. Even more confusing, HTML5 Audio continues to be played in silent mode, but Webaudio is muted. I'm using iPadOS 16.3.1.
This also occurs in 17.1.
Can you try: navigator.audioSession.type = 'playback';
This should help for silent mode at least. We need to do more work for the background case.
Setting navigator.audioSession.type to 'playback' or 'play-and-record' helps. Thanks.