blackuy / react-native-twilio-video-webrtc

Twilio Video (WebRTC) for React Native
https://www.twilio.com/docs/video
MIT License
609 stars 404 forks source link

Microphone stops working after minimizing the app (React Native for Android, with Twilio) #639

Open brenonesto opened 2 years ago

brenonesto commented 2 years ago

I'm having this issue that, during video calls using react-native-twilio-video-webrtc (https://github.com/blackuy/react-native-twilio-video-webrtc), after the user minimizes and goes back to the app, the microphone stops working.

This problem happens specifically on Android devices (I've already tested it on iOS) and the curious thing is that, while the app is in the background, right after minimized, the microphone continues to work and only stops when the app is reopened.

I've checked Android permissions and features in AndroidManifest.xml and tried removing/adding some, but nothing seems to work. I don't think that's the problem either, because the call works fine if the user doesn't minimize it. These are my current permissions:


    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.MICROPHONE"/>

    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
    <uses-feature android:name="android.hardware.microphone" android:required="false" />```

### Steps to reproduce
1. Enter a video call
2. Minimize app
3.

### Expected behaviour
The microphone should continue working

### Actual behaviour
The microphone stops working

### Environment
- **Node.js version**: v16.17.1
- **React Native version**: 0.63.4
- **React Native platform + platform version**: Android 10

### react-native-twilio-video-webrtc
**Version**: npm version or "master"
fukemy commented 2 years ago

for android you to enable foregroundService for keep microPhone work on background/foreground state

gauri-28 commented 1 year ago

for android you to enable foregroundService for keep microPhone work on background/foreground state

Can you provide any working example?