peer.setLocalDescription(answer) crashes the app

Hi there, I’m trying to setup the react-native-webrtc in our project. Unfortunately I encountered an issue during setting the localDescription for SDP answer. When I call peer.setLocalDescription with created answer the android app is being closed, no logs, no info. Did anyone have similar problem and know how to solve it? :slight_smile:

peer
  .setRemoteDescription(new RTCSessionDescription(payload))
  .then(() => {
    return peer.createAnswer();
  })
  .then(answer => {
    return peer.setLocalDescription(answer);
  })
  .then(() =>
    this.socket.emit("message", { payload: this.peer.localDescription })
  );

do not implement return, read the documentation

peer.setRemoteDescription(new RTCSessionDescription(payload))
        .then(() => {
            peer.createAnswer()
               .then((localDescription) => {
                   peer.setLocalDescription(localDescription)
                       then(() => {
                            // send messages to webSockets
                      })
              })
         })

@lucasHimelfarb Isn’t it the same?

anyway issue is already fixed. problem was related to missing configuration in AndroidManifest
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

3 Likes

Oh my god, you saved my day… I love you man/lady/alien or whoever, thanks