Reputation: 1710
I've created an Android client that uses WebRTC (M90) to communicate (audio/video) with other users in a room. I have implemented a Foreground service so I don't loose audio/video when the app is in the background for any amount of time. However, a problem exists if the client joins an empty room and goes into the background, and then another participant joins the room. Video will be established successfully once the app re-enters the foreground but audio will not be successfully established. Audio is attempted to be establish while the app is still in the background and I see the following errors?...
E/IAudioFlinger: createRecord returned error -1
E/AudioRecord: createRecord_l(-143896099): AudioFlinger could not create record track, status: -1
E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -1.
E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
E/org.webrtc.Logging: WebRtcAudioRecordExternal: Init recording error: Cannot create AudioRecord
Upvotes: 0
Views: 762
Reputation: 1710
Found the issue.. I had to change the foregroundServiceType from "mediaProjection" to "camera|microphone" like so...
android:foregroundServiceType="camera|microphone"
Upvotes: 1