react-native-webrtc: Audio call works fine with two devices on same Wifi, does not work if different Wifi's or mobile network

Expected behavior

I’d expect the audio streams to connect and work regardless of being on different Wifi networks.

Observerd behavior

Connection state says connected and ICE Candidate state is completed. Yet neither caller or callee can hear each other if not on the same Wifi network.

Steps to reproduce the problem

I am using a public stun server.

new RTCPeerConnection({
      iceServers:
      [
        {
          url: "stun:stun3.l.google.com:19302"
        }
      ]
    });

Platform information

  • React Native version: 0.63.2
  • Plugin version: 1.87.1
  • OS: iOS
  • OS version: 14

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 20 (4 by maintainers)

Most upvoted comments

You may need to specify a TURN server.

That SDP is correct, that’s how WebRTC does it since all transport information is in the ICE candidates. STUN alone won’t help you work in all networking scenarios, you need a TURN server.

I am not very good on the subject webrtc but it looks like a problem of turn server, i use the twillio turn server and I have no problem. I hope it will help you !

@saghul please reopen

@Sheleya unfortunately no I have not been able to resolve this issue. I have tried using a Twilio turn server as well but it did not resolve my issue.

@flhember would you be able to share your skeleton code so maybe we can see if we are doing something in the wrong order possibly?

I have the same problem. I developed and app that has both video and audio calling. If both of my devices are connected to the wifi everything is working ok. If I disconnect one phone and I put it on mobile data then nothing works. I mean the connection is made but on audiocall I get no sound and on video call I get no sound and no video stream.

I am also using a TURN server but the behavior is exactly the same even if I just use the STUN from google or my TURN server.

What could be the problem ?