Webrtc media over tcp?

牧云@^-^@ 提交于 2019-11-30 15:46:45

Forcing WebRTC media over TCP is not recommended, its just a fallback option for strict firewalls.

If you specify ?transport=tcp in TURN urls, then WebRTC client will connect to TURN Server over TCP.
Clients will send STUN requests over TCP to allocate relay candidates (As far as i know, currently chrome/firefox only request UDP relay candidates).

To force strict TCP via TURN server:

  • Use only TURN url with ?transport=tcp
  • Specify iceTransportPolicy:"relay", so that all media will flow via TURN

After exchanging the relay candidates(udp) between peerConnections, the media path will be as below

P1 <--TCP--> P1TURN <--UDP--> P2TURN <--TCP--> P2

If both P1TURN & P2TURN are always same, then you can choose TURN relay path as LAN/lo interface i.e. you will get UDP relay candidates with LAN/lo IP.

If you want to avoid UDP & two times TURN in the media path, you need to use some SFU/SVC like Jitsi(supports pseudo-SSL candidates)/Janus.
Then media path will be as below

P1 <--TCP--> SFU/MCU <--TCP--> P2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!