I'm working on WebRtc native android application. Im also compiling io.pristine lib. Im able to establish calls between two devices only if both of them are connected to the wifi. In case when one of the devices is connected to the cellular network im not able to establish call. I read any possible forum out there and its look like I need TURN server. I already run my own TURN server but idk how I can force the app to use this server. Any help is welcome. Thank you!!
You can use WebRTC facilities in the Android Platform with the help of Ant Media Server's Native WebRTC Android SDK. In this blog post, features of Webrtc Android SDK will be presented with a sample Android project which comes bundled with the SDK.
For most WebRTC applications to function a server is required for relaying the traffic between peers, since a direct socket is often not possible between the clients (unless they reside on the same local network). The common way to solve this is by using a TURN server.
WebRTC deprecated old API to create ICE servers. (Answer which uses old API)
To create ICE server you need to use IceServer builder pattern.
PeerConnection.IceServer stun = PeerConnection.IceServer.builder("stun:stun.l.google.com:19302").createIceServer();
PeerConnection.IceServer turn = PeerConnection.IceServer.builder("turn:numb.viagenie.ca").setUsername("[email protected]").setPassword("muazkh").createIceServer();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With