0
votes

I am trying to connect two peer in flutter webrtc but i am getting below error.I am using firebase as a signalling server.

  [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Unable to RTCPeerConnection::setRemoteDescription: peerConnectionSetRemoteDescription(): WEBRTC_SET_REMOTE_DESCRIPTION_ERROR: Failed to set remote answer sdp: Called in wrong state: stable

I am using below code in listening to the changes in firebase

         if (val['t'] == "ans") {
            assert(isInitiator);
            _peerCon.setRemoteDescription(
              RTCSessionDescription(
                val['sdp'],
                val['tp'],
              ),
            );
            return;
          }
1

1 Answers

0
votes

One peer connection can only set one remote description.

You are trying to setRemoteDescription on a peer with an already established connection. That's why you getting this error.

Check this thread for more details: Failed to set remote answer sdp: Called in wrong state: stable