I'm trying to implement WebRTC on Android for p2p communication. Then I tried to clone one of the examples from here. In that project, I noticed that he used a STUN server to create peer a connection between devices.
private val iceServer = listOf(
PeerConnection.IceServer.builder("stun:stun.l.google.com:19302").createIceServer(),
)
I tried to launch the app then it works fine until I change one of my devices' connectivity from local Wifi to 4G mobile data. This definitely means that 2 devices are behind different networks. So I changed my ICE server to a public TURN server from openrelayproject
. I've tested the TURN server and it works properly based on trickle ICE.
However, the video call performed in the program still not working and the recipient screen keeps getting blank. I also tried to use TCP in the TURN server like he does, but no difference.
Is there something I could do to fix this? I also don't know how to pass the data to the TURN server, or is it done automatically? Any code example would be a great help.