javascript - WebRTC The ICE candidate could not be added -
i trying establish p2p audio/video connection b/w 2 peers. following: getting started webrtc.
it works fine @ home in lan environment between 2 pcs, throws error message when running @ company's lan environment, there part javascript
function processsignalingmessage(message) { var msg = json.parse(message); if (msg.type === 'offer') { // callee creates peerconnection if (!initiator && !started) maybestart(); // know jsep version after createpeerconnection(). if (isrtcpeerconnection) pc.setremotedescription(new rtcsessiondescription(msg)); else pc.setremotedescription(pc.sdp_offer, new sessiondescription(msg.sdp)); doanswer(); } else if (msg.type === 'answer' && started) { pc.setremotedescription(new rtcsessiondescription(msg)); } else if (msg.type === 'candidate' && started) { var candidate = new rtcicecandidate({ sdpmlineindex : msg.label, candidate : msg.candidate }); pc.addicecandidate(candidate); } else if (msg.type === 'bye' && started) { onremotehangup(); } }
when first user recieved message "type":"candidate",get wrong
and part of console log:
- creating peerconnection
- created webkitrtcpeerconnnection config "{"iceservers":[{"url":"stun:stun.l.google.com:19302"}]}"
- adding local stream
- sending answer peer
- recieved message : {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:1613033416 1 udp 2113937151 192.168.1.233 56946 typ host generation 0\r\n"}
- uncaught syntaxerror: failed execute 'addicecandidate' on 'rtcpeerconnection': ice candidate not added
- recieved message : {"type":"candidat".......}
- uncaught syntaxerror: failed execute 'addicecandidate' on 'rtcpeerconnection': ice candidate not added
- recieved message : {"type":"candidat".......}
- uncaught syntaxerror: failed execute 'addicecandidate' on 'rtcpeerconnection': ice candidate not added
i think can create ice candidate message using msg.candidate,
var candidate = new rtcicecandidate(msg.candidate);
and pass addicecandidate
function
Comments
Post a Comment