2

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;
          }
Bilal Rabbi
  • 1,602
  • 2
  • 18
  • 39

1 Answers1

2

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

lnogueir
  • 1,859
  • 2
  • 10
  • 21