Handling ICE Candidate Processing Using PeerConnection?

I have exhausted all possibilities to get WebRTC stable, and I want to get some tips.

All possible solutions for processing a working Internet browser were taken into account, for example:

  • Waiting until all candidates are collected before sending SDP in Chrome browsers.
  • Sending candidates as soon as they are collected, and adding them to the remote connection after setting the local sdp.
  • adding candidates after installing both local and remote descriptions (for remote and local)
  • adding candidates' proposals when receiving and sending candidates with a response
  • peer reboot when ice breaks
  • others (in a hurry)

Basically, I ask someone to help with the help of a diagram or a step-by-step process in which to lie SHOULD be processed in order to have a working solution for cross-browser with chrome and firefox (both updated and current posting time).

I burned myself out of the thought of any other possibilities at this moment, and any help would be greatly appreciated.

Thanks Dec :)

+4
source share
2 answers

I sympathize with your disappointments.

RTCPeerConnection, createOffer(), setLocalDescription(), ICE ICE. , Trickle ICE, , , , ( -, , , ).

Trickle:

RTCPeerConnectionIceEvent:

peerConnection.onicecandidate = function(newRTCPeerConnectionIceEvent) {

    var newCandidate = newRTCPeerConnectionIceEvent.candidate;
    // send candidate to remote via signalling channel
}

:

peerConnection.addIceCandidate(RTCIceCandidate);

setRemoteDescription , , , remoteDescription, . . ICE- .

:

, :

peerConnection.onicecandidate = function(newRTCPeerConnectionIceEvent) {

    if (newRTCPeerConnectionIceEvent.candidate === null) {

       // send the offer (generated previously) to the remote peer
       // the offer sdp should contain all the gathered candidates
    }
}

: http://muaz-khan.blogspot.co.uk/2015/01/disable-ice-trickling.html (. sdp, ).

, , .. - . , trickle , , ​​ .

+5

:)

function waitForAllICE(pc) {
  return new Promise((fufill, reject) => {
    pc.onicecandidate = (iceEvent) => {
      if (iceEvent.candidate === null) fufill()
    }
      setTimeout(() => reject("Waited a long time for ice candidates..."), 10000)
  }) 
} 

-

pc.createOffer()
  .then(offer => pc.setLocalDescription(offer))
  .then(  ()  => waitForAllICE(pc))
  .then(  ()  => signallingWire.send(pc.localDescription))
  .catch(  e  => smartErrorHandling(e))
+1

All Articles