Bug 226620

Summary: Microphone stopped/paused when application goes to background
Product: WebKit Reporter: dharjanto
Component: WebRTCAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: clshortfuse, glefebvr, haimomesi, nicolas.gerlach, victor.dombrovskiy, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: iPhone / iPad   
OS: iOS 14   
See Also: https://bugs.webkit.org/show_bug.cgi?id=217948
https://bugs.webkit.org/show_bug.cgi?id=241480
https://bugs.webkit.org/show_bug.cgi?id=233419

dharjanto
Reported 2021-06-03 18:38:39 PDT
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: https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_ios_and_tvos/enabling_background_audio 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.
Attachments
Radar WebKit Bug Importer
Comment 1 2021-06-10 18:39:17 PDT
nicolas.gerlach
Comment 2 2022-03-23 02:33:30 PDT
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?
youenn fablet
Comment 3 2022-03-23 03:18:47 PDT
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.
Carlos Lopez
Comment 4 2024-10-19 09:32:33 PDT
This is broken on Web Apps that use Add to Home Screen. Safari: Works Add to Home Screen: Microphone stopped working.
Note You need to log in before you can comment on or make changes to this bug.