I have deployed the server for streaming https://github.com/webrtc/apprtc/blob/master/README.md
This is the Android app: https://github.com/appsroxcom/WebRTCAndroid
If I connect with different browsers, it works but the Android app is crashing. The Android app doesn't seem to create the PeerConnection. The error is : 2021-10-16 19:11:02.802 9157-9459/com.example.webrtc.android A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 9459 (pool-1-thread-1)
I have seen that the reason for this error is this: 2021-10-16 18:47:49.341 32549-32605/com.example.webrtc.android W/ice_server_parsing.cc: (line 182): Invalid transport parameter in ICE URI: ["turn:mydomain.com:3478"]
I do not know how to fix this for Android. I tried different configurations for turn including those with ?transport
"urls": [
"turn:hostnameForYourTurnServer:19305?transport=udp",
"turn:hostnameForYourTurnServer:19305?transport=tcp"
],
What should I do?
THanks
in apprtc src/app_engine/constants.py, urls is a json array
# ICE_SERVER_OVERRIDE = [
# {
# "urls": [
# "turn:hostname/IpToTurnServer:19305?transport=udp",
# "turn:hostname/IpToTurnServer:19305?transport=tcp"
# ],
# "username": "TurnServerUsername",
# "credential": "TurnServerCredentials"
# },
# {
# "urls": [
# "stun:hostname/IpToStunServer:19302"
# ]
# }
# ]
but the android app treat it as a json string here
String url = server.getString("urls");
so you should change android code to
private List<PeerConnection.IceServer> iceServersFromPCConfigJSON(String pcConfig)
throws JSONException {
JSONObject json = new JSONObject(pcConfig);
JSONArray servers = json.getJSONArray("iceServers");
List<PeerConnection.IceServer> ret = new ArrayList<>();
for (int i = 0; i < servers.length(); ++i) {
JSONObject server = servers.getJSONObject(i);
JSONArray urls = server.getJSONArray("urls");
String username = server.has("username") ? server.getString("username") : "";
String credential = server.has("credential") ? server.getString("credential") : "";
for (int j = 0; j < urls.length(); ++j) {
String url = urls.getString(j);
PeerConnection.IceServer turnServer =
PeerConnection.IceServer.builder(url)
.setUsername(username)
.setPassword(credential)
.createIceServer();
ret.add(turnServer);
}
}
return ret;
}