WebRTC connection issue for iOS

Viewed 72

For my current project, I need to create a WebRTC connection between an iOS app and a Python server.

I am using WebRTC-lib to create a connection and the code compiles and run, but I have encountered various issues:

  1. Video streaming doesn't function properly. That Python side doesn't receive the video frames and just gets stuck when trying to receive the frame.
  2. The connection fails for an unknown reason. Sometimes I run the app and the connection is established successfully, but more often the connection fails even though nothing change on the app nor on the Python side.

Has anyone encountered those issues, or know how to solve them?

This is my current code:

self.webRTCClient = WebRTCClient(iceServers: Constants.Config.defaultIceServers)
self.webRTCClient.delegate = self

self.webRTCClient.offer { (localSDP) in
     ServerManager.shared().offer(sdp: localSDP.sdp) { remoteSDP in
         let temp = RTCSessionDescription(type: RTCSdpType(rawValue: 2)!, sdp: remoteSDP)
         self.webRTCClient.set(remoteSdp: temp) { (error) in
                    
            let string = "..."
            guard let dataToSend = string.data(using: .utf8) else {
                return
            }
            self.webRTCClient.sendData(dataToSend)
         }
     }
}

Thanks

1 Answers

I think IceServers is not set properly, check Turn server, If you not configured, first configure Turn server. To check IceServers issue or not, test it with same wifi network. If it is working on same network and not working in different networks then it must be Turn server issue.

Related