Search code examples
webrtc

WebRTC - JSEP: cannot connect peer between two different network


I don't know if anybody have issued this, but I wan't to ask. My problem was like this:

  • I could use video chatting from apprtc.appspot.com using two Chrome tab (which means I call myself). Everything worked well.
  • I could use apprtc with two different laptop as well, if those laptop were on the same network. I used my university's network behind proxy.
  • However, apprtc didn't work if I used it with one laptop on modem, and the other on LAN.

Can anybody explain what happened? Is this STUN/ICE problem? Or JSEP?


Solution

  • I've been able to use the demo at http://apprtc.appspot.com/ from behind two different NAT's. So it can at least work in theory; but it's also fairly well known that STUN, TURN and ICE aren't infallible. For starters, if someone has blocked access to the port 19302 (the port of the STUN server that the apprtc demo uses), the firewall traversal will never be able to get started.

    The basic troubleshooting step would be to open up the Chrome developer tools (ctrl-shift-i) and look to see if there are any errors in the console. Failing to observe anything interesting there, you'd need to write up your own version of the demo app, this time with better error handling. For instance, the apprtc demo assumes certain things that can't really be taken for granted, for instance, that peerConnection.setLocalDescripton() and peerConnection.setRemoteDescription() will succeed. In production code, you'd really need to implement both success and failure callbacks on those - and that would give you better information about what might be going wrong.