Get participants update to work

This commit is contained in:
Mario Danic 2018-10-17 14:12:29 +02:00
parent db026c4a9e
commit 83a91539fb
2 changed files with 17 additions and 17 deletions

View File

@ -1024,7 +1024,7 @@ public class CallController extends BaseController {
}
private void joinRoomAndCall() {
if ("0".equals(callSession) || externalSignalingServer != null) {
if ("0".equals(callSession)) {
ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, roomToken), null)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
@ -1037,12 +1037,8 @@ public class CallController extends BaseController {
@Override
public void onNext(CallOverall callOverall) {
if (externalSignalingServer == null) {
callSession = callOverall.getOcs().getData().getSessionId();
performCall();
} else {
webSocketClient.joinRoomWithRoomToken(roomToken);
}
callSession = callOverall.getOcs().getData().getSessionId();
callOrJoinRoomViaWebSocket();
}
@Override
@ -1056,7 +1052,15 @@ public class CallController extends BaseController {
}
});
} else {
callOrJoinRoomViaWebSocket();
}
}
private void callOrJoinRoomViaWebSocket() {
if (externalSignalingServer == null) {
performCall();
} else {
webSocketClient.joinRoomWithRoomTokenAndSession(roomToken, callSession);
}
}
@ -1171,7 +1175,7 @@ public class CallController extends BaseController {
} else {
alwaysGetPeerConnectionWrapperForSessionId(callSession, true);
alwaysGetPeerConnectionWrapperForSessionId(webSocketClient.getSessionId(), true);
}
}
@ -1197,7 +1201,6 @@ public class CallController extends BaseController {
public void onMessageEvent(WebSocketCommunicationEvent webSocketCommunicationEvent) {
switch (webSocketCommunicationEvent.getType()) {
case "hello":
callSession = webSocketClient.getSessionId();
joinRoomAndCall();
break;
case "roomJoined":
@ -1373,7 +1376,7 @@ public class CallController extends BaseController {
@Override
public void onNext(GenericOverall genericOverall) {
if (externalSignalingServer != null) {
webSocketClient.joinRoomWithRoomToken("");
webSocketClient.joinRoomWithRoomTokenAndSession("", "");
}
if (isMultiSession) {
@ -1455,11 +1458,7 @@ public class CallController extends BaseController {
}
for (MagicPeerConnectionWrapper magicPeerConnectionWrapper : magicPeerConnectionWrapperList) {
if (externalSignalingServer != null && callSession.equals(magicPeerConnectionWrapper.getSessionId())) {
oldSesssions.add(magicPeerConnectionWrapper.getSessionId());
} else {
oldSesssions.add(magicPeerConnectionWrapper.getSessionId());
}
oldSesssions.add(magicPeerConnectionWrapper.getSessionId());
}
// Calculate sessions that left the call
@ -1716,6 +1715,7 @@ public class CallController extends BaseController {
}
});
} else {
Log.d("MARIO", "SENDING CALL MESSAGE " + ncMessageWrapper.getSignalingMessage().getType());
webSocketClient.sendCallMessage(ncMessageWrapper);
}
}

View File

@ -202,9 +202,9 @@ public class MagicWebSocketInstance extends WebSocketListener {
return hasMCU;
}
public void joinRoomWithRoomToken(String roomToken) {
public void joinRoomWithRoomTokenAndSession(String roomToken, String normalBackendSession) {
try {
webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledJoinOrLeaveRoomModel(roomToken, sessionId)));
webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledJoinOrLeaveRoomModel(roomToken, normalBackendSession)));
} catch (IOException e) {
Log.e(TAG, "Failed to serialize room overall websocket message");
}