webrtcsimple-peer

Simple peer different network calling Issue


I am using simple peer for my video call web application. when I call people in the same network video call is working perfectly. But in the different networks, it is not working. I also added ICE servers(stun/turn) to simple peer. Still, the same issue is happening can anyone please help me out. I am getting this issue in the console

Error: Connection failed. at h (index.js:17)at f.value (index.js:654) at RTCPeerConnection.t._pc.onconnectionstatechange (index.js:119)

const peer = new Peer({
  initiator: true,
  trickle: false,
  stream,
  config: {

    iceServers: [
        {
            urls: "stun:numb.viagenie.ca",
            username: "************",
            credential: "************"
        },
        {
            urls: "turn:numb.viagenie.ca",
            username: "************",
            credential: "************"
        }
    ]
}
});

Solution

  • my issue here was with the stun/turn server.we can check the status of servers using https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/

    If you test a STUN server, it works if you can gather a candidate with type "srflx". If you test a TURN server, it works if you can gather a candidate with type "relay".

    check you are getting this