Skip to content Skip to sidebar Skip to footer

Webrtc: Called In Wrong State: State_sentoffer

I'm following this tutorial, to make a simple example of WebRTC. But the remote video does not appear in any browser and Chrome does not show the error: Uncaught (in promise) DOME

Solution 1:

Hard to answer without seeing code, but you have at least two problems, judging by the two errors:

Uncaught (in promise) DOMException: Error processing ICE candidate

This is from peerConn.addIceCandidate(candidate) and there's something wrong with the candidate input, suggesting it's incorrect or mangled somehow. You're supposed to signal it over your signaling channel from the other side's peerConn.onicecandidate. Show code please if more help is needed.

It's "uncaught" because it returns a promise, and you're missing a .catch:

peerConn.addIceCandidate(candidate).catch(e =>console.log(e));

OperationError: Failed to set remote offer sdp: Called in wrong state: STATE_SENTOFFER

This suggests both peers tried to send an offer at the same time, which is symmetric and wrong.

The offer/answer exchange is inherently asymmetric. One side must start with an offer, the other side receives it, does SetRemote, createAnswer, and sends answer back to the first peer, which does setRemote. This dance is a state-machine. Any misstep and you get an error like this.

Post a Comment for "Webrtc: Called In Wrong State: State_sentoffer"