WebRTC:createOffer在Chrome中调用两次成功回调 [英] WebRTC: createOffer's success callback called twice in Chrome
问题描述
我正在使用
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.
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()
:
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
这篇关于WebRTC:createOffer在Chrome中调用两次成功回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!