webrtc-unity-plugin icon indicating copy to clipboard operation
webrtc-unity-plugin copied to clipboard

Create answer problem.

Open Qualcuno opened this issue 3 years ago • 1 comments

Hi, great work with this plugin.

I'm facing into answer generation problem ... PeerEventsInstance.SetRemoteDescription("offer", sdp); PeerEventsInstance.CreateAnswer(); ... After CreateAnswer is called, unity shows me this error

PeerConnection cannot create an answer in a state other than have-remote-offer or have-local-pranswer.
UnityEngine.Debug:LogError(Object)
UnityWebrtc.WebrtcPeerEvents:OnFailure_Listener(String) (at Assets/UnityWebrtc/WebrtcPeerEvents.cs:189)
UnityEngine.Events.UnityEvent`1:Invoke(String)
UnityWebrtc.<>c__DisplayClass20_0:<Peer_FailureMessage>b__0() (at Assets/UnityWebrtc/WebrtcPeerEvents.cs:233)
UnityWebrtc.WebrtcPeerEvents:Update() (at Assets/UnityWebrtc/WebrtcPeerEvents.cs:155)

Surfing on web i found that a solution can be call CreateAnswer after SetRemoteDescritpion has finished completly ( setRemoteDescription.then(...) ), so i tried to call CreateAsnwer after some seconds without success. Any idea? Thanks

Qualcuno avatar Sep 02 '20 14:09 Qualcuno

Hmm - not sure on this one. Maybe you could try logging the sdp contents and share that here? It's possible that SetRemoteDescription is failing.

Unfortunately this library doesn't currently have a way to inspect the state of the underlying peer instance, so we can't add a line that explicitly checks that state. However, that error does look like the peer isn't registering the remote offer (the peer contains a few finite state machines - the one that's in play here is this one).

bengreenier avatar Oct 26 '20 16:10 bengreenier