0

I am using webrtc RtcPeerConnection API in Chrome.

My local SDP offer is like this

a=candidate:0 1 UDP 2122252543 10.100.49.26 59882 typ host
a=candidate:1 1 TCP 2105524479 10.100.49.26 9 typ host tcptype active

I think if UDP is not working, it will try TCP.

But! I don't want TCP and TCP connection can cause exceptions, How can I remove the TCP line from my local SDP offer?

AJLoveChina
  • 574
  • 6
  • 15

1 Answers1

1

You can just remove the line which contains the a=candidate TCP line, before calling the setLocalDecription and sending to the peer.

However, chrome by default supports ICE trickle to speed up the connection setup process and does not require to gather all the candidates before sending the SDP. So, you can set the SDP immediately after generation and easily filter out the unwanted candidates before sending them to the other peer in the onicecandidate callback.

rtcPeerConnection.onicecandidate = event => {
      if (event.candidate && event.candidate.protocol !== 'tcp') {
         // send to peer
      }
}