javascript - RTCPeerConnection.addIceCandidate() - Uncaught SyntaxError: An invalid or illegal string was specified -
the addicecandidate()
function giving me error post title, "uncaught syntaxerror: invalid or illegal string specified."
the parameter pass rtcicecandidate object. can print out candidate
-attribute result, of them a=candidate:1086438664 2 udp 41754367 41.117.144.193 64564 typ relay raddr 82.146.26.23 rport 58089 generation 0
, on.
this function pass parameter:
function receiveicecandidate(candidate) { parsecandidate = new rtcicecandidate(json.parse(candidate)); //console.log("parsecandidate.cand = " + parsecandidate.candidate); remotepc.addicecandidate(parsecandidate); //remotepc rtcpeerconnection }
before function ever called, remotepc receives sdp offer , sets remotedescription, in following function:
function receiveoffer(offer) { var ischrome = !!navigator.webkitgetusermedia; var stun = { url: ischrome ? 'stun:stun.l.google.com:19302' : 'stun:23.21.150.121' }; var turn = { url: 'turn:homeo@turn.bistri.com:80', credential: 'homeo' }; var iceservers = { iceservers: [stun, turn] }; var sdpconstraints = { optional: [], mandatory: { offertoreceiveaudio: true, offertoreceivevideo: true } }; pc_config = {"iceservers": [{"url": "stun:stun.l.google.com:19302"}]}; remotepc = newpeerconnection(iceservers); // returns peerconnection suitable prefix browser remotepc.setremotedescription(new rtcsessiondescription(offer.sdp )); remotepc.createanswer(function(answer) { console.log("creating answer."); remotepc.setlocaldescription(answer); }); remotepc.onaddstream = function (evt) { console.log("on add stream.."); var remote_video = $("#remotevideo"); remote_video.src = createobjecturl(evt.stream); } }
onaddstream
, createanswer
never called far - related problem? don't think there's chance answer without icecandidates?
Comments
Post a Comment