Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC no video in different network

Sorry about my English. I have a problem with webRTC. My application works correctly in the same network but in different is wrong.

Technologies that I use:

  • socket.io
  • node
  • coffeescript
  • gulp
  • zenserver

In this github I push my code: github/oihi08/webrtc

I dont know why the application not runs with different networks. I have uploaded to a server, I tried it and nothing. But in the same network yes.

Thank you so much!!

like image 322
oihi08 Avatar asked Oct 12 '25 14:10

oihi08


1 Answers

It sounds like you aren't using a STUN/TURN server. There are a few steps to create a connection between two devices. One of these steps is to select one or more STUN/TURN servers (like "stun:stun.l.google.com:19302" for example). This server will be used to create a connection between peers, even when there is a firewall in the way on one or both ends.

When you set up one or more STUN/TURN servers, you will see that ice candidates will start being generated. The callback function peerConnection.onicecandidate will be called for every ice candidate that is generated. When the library is done generating ice candidates, it calls the callback one more time with NULL as parameter, this flags the end of the list of candidates.

You need to get these ice candidates across to the other peer somehow, usually through the same signaling server you use to create the connection in the first place. When they arrive at the other side you need to call peerconnection.addIceCandidate.

If you do these steps, you will be able to get a proper connection, even across networks with strict NAT types.

like image 139
lorenzo373 Avatar answered Oct 14 '25 08:10

lorenzo373