Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
991 views
in Technique[技术] by (71.8m points)

google chrome - Errors when ICE Candidates are received before answer is sent

I'm establishing WebRTC connection on Chrome 23. To attach local stream you need to allow browser to use the camera and microphone. On the caller side I'm checking if local stream can be obtained and I'm not sending offer until this moment. Then offer is sent and the browser immediately starts to send ICE candidates.

Then if remote browser didn't obtained local media stream yet I get SYNTAX_ERR: DOM Exception 12 on peerConnection.addIceCandidate(candidate) for every ICE candidate received.

I checked documentation on addIceCandidate but there is no info about prerequisites.

I think I can delay sending ICE candidates from offerer by delaying it and waiting for signal that remote client added local stream, but this is additional communication needed and doesn't look right.

Can I somehow add remote ICE candidates to webkitRTCPeerConnection before answer is sent and local media stream is attached?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After I wrote this question an answer came into my mind... There is no need for attaching local stream before receiving ICE candidates, but remoteDescription should be set (which should be done at the moment of receiving offer). In my code I waited with setting remoteDescription and sending answer until browser gets the local stream.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...