I have a problem related to Android and OpenVido. I connect from a computer and an Android tablet to a OpenVido Server. I would like to share my screen from the computer to the tablet. The first time everything works without problems and I can see the screen on the tablet. If I stop the screen share and start the screen share again, then it does not work anymore. After some research I figure out that the handler for unpublish a stream is not implemented on Android. The corresponding event which is sent from the OpenVido Server to the Android client is "JsonConstants.PARTICIPANT_PARTICIPANT_UNPUBLISHED".
Can anyone give me a hint which event or methods need to be triggered?
private void handleServerEvent(JSONObject json) throws JSONException {
if (!json.has(JsonConstants.METHOD)) {
Log.e(TAG, "Server event lacks a field '" + JsonConstants.METHOD + "'; JSON: "
+ json.toString());
return;
}
final String method = json.getString(JsonConstants.METHOD);
if (!json.has(JsonConstants.PARAMS)) {
Log.e(TAG, "Server event '" + method + "' lacks a field '" + JsonConstants.PARAMS
+ "'; JSON: " + json.toString());
return;
}
final JSONObject params = new JSONObject(json.getString(JsonConstants.PARAMS));
switch (method) {
case JsonConstants.ICE_CANDIDATE:
iceCandidateEvent(params);
break;
case JsonConstants.PARTICIPANT_JOINED:
participantJoinedEvent(params);
break;
case JsonConstants.PARTICIPANT_PUBLISHED:
participantPublishedEvent(params);
break;
case JsonConstants.PARTICIPANT_LEFT:
participantLeftEvent(params);
break;
case JsonConstants.PARTICIPANT_UNPUBLISHED:
//Missing
break;
default:
throw new JSONException("Unknown server event '" + method + "'");
}
}
Source of the code: https://github.com/OpenVidu/openvidu-tutorials/blob/master/openvidu-android/app/src/main/java/io/openvidu/openvidu_android/websocket/CustomWebSocket.java