Question

I'm playing with WebRTC and following this article. Now I experiencing strange behaviour in Chrome (Mozilla work fine) - when I call createOffer I pass a success callback (named RTCSessionDescriptionCallback in W3C draft) in and then strange thing is that in Chrome this callback get called twice! This leads setLocalDescription to be also called twice and first it succeed but second call return error:

failed to set description SetLocalDescription failed: Failed to push down offer transport description. 

So can any one suggest why this happens on chrome (I use version 31.0.1650.63)?

Here is the plunk for this.

Was it helpful?

Solution

I already expected that this was a problem with onnegotiationneeded and yes. When you change line 37 to console.trace, you can see which code called your function createOffer():

console.trace

What you want to do is create and set an offer first, and then add the onnegotiationneeded. This will prevent any errors. As you are following a tutorial, see this working example

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top