Mr. Robot
Mr. Robot

Reputation: 1824

Android React Native app crashes on getUserMedia WebRTC call

I have been debugging this and no longer have many options, hence the long shot question - I'm using the ConnectyCube WebRTC video calling package for React Native. I have also tried using the react-native-webrtc package to stream video from my Android device.

When using both packages my app crashes without any logs or errors when I call the getUserMedia method. I have to build the app again to use it.

Here is a previous post of mine that describes earlier problems I was having - however if you download and build ConnectyCubes app from the above link, their app works - I can't figure out why mine doesn't.

So my question is, is is there anything I should be checking for relating to the getUserMedia call in React Native that might be stopping it working?

I'm using:

RN v0.59.9 
gradle wrapper 5.4.1 
classpath(“com.android.tools.build:gradle:3.4.1”)
buildToolsVersion = “28.0.3”
compileSdkVersion = 28

I have reached out to support but have no fix yet.

Strangely, I'm unable to log the session parameter at certain points in the function.

const getUserMedia = session => {
  console.log(session); // logs here 
  return new Promise((resolve, reject) => {
    console.log(session); // but not here
    session.getUserMedia({
      audio: true,
      video: { facingMode: 'user' }
    }, function (error, stream) {
      console.log(error, stream) // or here
      error ? reject(error) : resolve(stream);
    });
  });
}

#Update# The issue with the function above might be that for some reason the crash happens before the console can print anything out.

Upvotes: 3

Views: 1107

Answers (1)

Mr. Robot
Mr. Robot

Reputation: 1824

This was fixed by deleting the gradle cache and running npm i as described here:

How to clear gradle cache?

Upvotes: 0

Related Questions