While on a voice call from web application using WkWebView, if the application went to background or pressed power button, the microphone stopped transmitting voice. The audio from the other peers continued to play but eventually stopped playing at all. Adding Background Modes capabilities as described here doesn't help at all:
We tried passing alwaysRunsAtForegroundPriority option when creating WKWebView, but using this option is considered as Private API according to Apple.
Is there a way to keep the microphone to continue transmitting the voice and playing peers audio? Thank you.
I'm having the same issue with a webapp in Safari on Mac (BigSur / Monterey).
Safari microhone capture via getUserMedia does only work when the Safari window is visible on the screen (1px visible is sufficient). Whenever Safari is moved to the background the microphone stops transmitting sound, as if it was muted by a hardware button. For the web-application this is not transparent afaik.
This behaviour is especially inconvenient for multi user web-apps using webrtc, where microphone input can be used together with screen sharing (getDisplayMedia). Users usually assume that they can be heared when sharing their entire screen, even if safari is not in the foreground / visible. It feels inconsistent to on the one hand allow screen sharing when the safari window is not visible, but on the other hand block microphone transmission.
Can someone clarify if this behaviour is intentional and if there is a way to resolve this via settings or something else?
@dharjanto Were you able to resolve this?
It is not expected that audio tracks be muted in Safari on Mac.
https://webrtc.github.io/samples/src/content/peerconnection/pc1/ continues to play audio for me when Safari is in the background.
Note that, when being backgrounded, silent WebAudio used to be suspended, we recently fixed this issue.
@Nicolas, can you validate what the exact issue is? If that is still not working, can you file a new bug with as much input as possible?
@dharjanto, for WKWebView, muting is happening on iOS in case UIBackgroundModes (https://developer.apple.com/documentation/bundleresources/information_property_list/uibackgroundmodes) does not contain "audio".
Can you try that?
Closing this bug as behaving correctly, for now.
Feel free to reopen as needed.