openvidu-server: Simplify readIceServer method to load OPENVIDU_WEBRTC_ICE_SERVERS

pull/701/head
cruizba 2022-02-24 21:59:00 +01:00
parent 963191fe93
commit af5efc4de4
1 changed files with 7 additions and 12 deletions

View File

@ -1192,17 +1192,12 @@ public class OpenviduConfig {
String url = null, username = null, credential = null; String url = null, username = null, credential = null;
String[] iceServerPropList = iceServerString.split(","); String[] iceServerPropList = iceServerString.split(",");
for (String iceServerProp: iceServerPropList) { for (String iceServerProp: iceServerPropList) {
String[] iceServerPropEntry = iceServerProp.split("=");
if (iceServerPropEntry.length == 2) {
if (iceServerProp.startsWith("url=")) { if (iceServerProp.startsWith("url=")) {
url = iceServerPropEntry[1]; url = StringUtils.substringAfter(iceServerProp, "url=");
} else if (iceServerProp.startsWith("username=")) { } else if (iceServerProp.startsWith("username=")) {
username = iceServerPropEntry[1]; username = StringUtils.substringAfter(iceServerProp, "username=");
} else if (iceServerProp.startsWith("credential=")) { } else if (iceServerProp.startsWith("credential=")) {
credential = iceServerPropEntry[1]; credential = StringUtils.substringAfter(iceServerProp, "credential=");
} else {
addError(property, "Wrong parameter: " + iceServerProp);
}
} else { } else {
addError(property, "Wrong parameter: " + iceServerProp); addError(property, "Wrong parameter: " + iceServerProp);
} }