Bug 251532

Summary: REGRESSION (iOS 16.3): WebAudio muted when the silent switch is ON and when app goes to background
Product: WebKit Reporter: Adrien iWebDJ <adrien.wurth>
Component: Web AudioAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Critical CC: cdumez, hamish, jer.noble, mattwindwer, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: iPhone / iPad   
OS: iOS 16   

Description Adrien iWebDJ 2023-02-01 10:57:22 PST
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!!
Comment 1 Alexey Proskuryakov 2023-02-02 18:46:01 PST
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.
Comment 2 Radar WebKit Bug Importer 2023-02-02 18:46:14 PST
<rdar://problem/104987540>
Comment 3 youenn fablet 2023-02-03 00:15:32 PST
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.
Comment 4 hamish@risingsoftware.com 2023-11-12 19:33:29 PST
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.
Comment 5 hamish@risingsoftware.com 2023-11-12 21:11:58 PST
This also occurs in 17.1.
Comment 6 youenn fablet 2023-11-12 22:29:27 PST
Can you try: navigator.audioSession.type = 'playback';
Comment 7 youenn fablet 2023-11-12 22:30:08 PST
This should help for silent mode at least. We need to do more work for the background case.
Comment 8 hamish@risingsoftware.com 2023-11-12 23:27:53 PST
Setting navigator.audioSession.type to 'playback' or 'play-and-record' helps. Thanks.