1

So, i'm trying to build a webrtc video chat web app using peer.js. So far so good, everything seems to work right. The problem starts when i run my app on my private server.

Everytime i try to answer or make a call the video starts playing for a few seconds, but with black screen, and then i get the ICE Failed error and it disconnects.

This wont happen if the two users share the same ip address. If the users share the same ip the video chat works fine and there is no problem at all.

What could be the problem here?

UPDATE

i added stun and turn server on peer but i get the same error again

peer = new Peer({ key: peerApiKey, debug: 3, config: {'iceServers': [
            { url: 'stun:stun.l.google.com:19302' },
            { url: 'stun:stun1.l.google.com:19302' },
            { url: 'turn:numb.viagenie.ca:3478', credential: 'muazkh', username:'webrtc@live.com' },
            { url: 'turn:numb.viagenie.ca', credential: 'muazkh', username:'webrtc@live.com' },
            { url: 'turn:192.158.29.39:3478?transport=udp', credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=', username:'28224511:1379330808' },
            { url: 'turn:192.158.29.39:3478?transport=tcp', credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=', username:'28224511:1379330808' }
        ]}});
Dimitris Konomis
  • 326
  • 3
  • 13

1 Answers1

2
  • You need to set a valid STUN server (maybe the peer.js defaults are not working). This will solve the problem in around 80% of the cases.
  • In some situations a TURN service is also required to complete the calls.
  • And in some situations even TURN is not enough (for example if UDP is blocked for both end) and in these circumstances you need a server to route the media (via TCP/TURN).
Istvan
  • 1,591
  • 1
  • 13
  • 19
  • Thank you for your answer.I added stun and turn server but i get tha same error again – Dimitris Konomis May 26 '16 at 10:41
  • Are you sure that those TURN servers are really working? You should not count on a free/public TURN service.TURN have to route the media which can be very costly if a lots of users are using it and as I know, nobody provides this service for free. – Istvan May 27 '16 at 09:34
  • Actually it did worked after a while (there was a problem with my server).My problem now is that it's only making a call or answering with wifi and not with 3g/4g and i'm trying to figure that out too. Thanks for your help! – Dimitris Konomis May 29 '16 at 11:47