1

I'm developing a WebRTC voice calling app for Android using PeerJS, where all the PeerJS code runs within a WebView inside my CallScreen activity. The calling functionality works flawlessly. However, I've encountered an issue specific to Android 12 and higher devices: the microphone stops functioning as soon as the screen is locked or the user navigates to another app.

I've researched this extensively, and most suggestions online recommend using a Foreground service to record audio. Unfortunately, this isn't feasible in my scenario because I'm trying to access the microphone from a WebView within an activity.

Is there any workaround or solution to resolve this microphone issue on Android 12+ devices while still operating within the constraints of a WebView within an activity? Any insights or alternative approaches would be greatly appreciated. Thank you.

3
  • Using a foreground service is the way to go actually. You can access microphone data in the service and then send it to PeerJS webview accordingly. Commented Mar 20, 2024 at 18:28
  • How can I send microphone data from service to webview??? Commented Mar 21, 2024 at 7:03
  • @SujithSManjavana I have the same issue I setup sip.js in web view to stop the microphone when locking the device. did you get the solution if yes can you share it with me Commented Nov 16, 2024 at 6:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.