I’ve built a ReactJS web application that uses the mobile device’s microphone through the browser (using getUserMedia). Everything works correctly while the device screen is on and the browser is in the foreground.
However, when the mobile device gets locked (screen turns off), the microphone becomes inaccessible, and the stream stops.
I have tested this on multiple devices/browsers, and it seems consistent across them.
What I want to know:
Is it possible for a web application (PWA or regular website) to keep accessing the microphone when the mobile device is locked?
Are there any browser APIs, flags, or permissions that allow background audio recording on mobile?
If not possible on the web, is there any known workaround?
(For example: turning the app into a full PWA with background service workers, or using WebRTC, etc.)
Additional Information:
Framework: ReactJS
Using:
navigator.mediaDevices.getUserMedia({ audio: true })Platforms tested: Android Chrome, Samsung Internet, iOS Safari
Behavior: Once the screen locks, microphone access stops immediately.
I’m trying to determine whether this is a browser limitation or if there’s a method to keep recording audio while the phone is locked.