openvidu-server: property "recording" of JSON sessions added in Session class

pull/203/head
pabloFuente 2019-02-08 21:09:12 +01:00
parent 6e65191860
commit a94d9d0497
2 changed files with 2 additions and 4 deletions

View File

@ -159,6 +159,7 @@ public class Session implements SessionInterface {
connections.addProperty("numberOfElements", participants.size()); connections.addProperty("numberOfElements", participants.size());
connections.add("content", participants); connections.add("content", participants);
json.add("connections", connections); json.add("connections", connections);
json.addProperty("recording", this.recordingManager.sessionIsBeingRecorded(this.sessionId));
return json; return json;
} }

View File

@ -98,13 +98,12 @@ public class SessionRestController {
defaultOutputModeString = (String) params.get("defaultOutputMode"); defaultOutputModeString = (String) params.get("defaultOutputMode");
defaultRecordingLayoutString = (String) params.get("defaultRecordingLayout"); defaultRecordingLayoutString = (String) params.get("defaultRecordingLayout");
defaultCustomLayout = (String) params.get("defaultCustomLayout"); defaultCustomLayout = (String) params.get("defaultCustomLayout");
customSessionId = (String) params.get("customSessionId");
} catch (ClassCastException e) { } catch (ClassCastException e) {
return this.generateErrorResponse("Type error in some parameter", "/api/sessions", return this.generateErrorResponse("Type error in some parameter", "/api/sessions",
HttpStatus.BAD_REQUEST); HttpStatus.BAD_REQUEST);
} }
customSessionId = (String) params.get("customSessionId");
try { try {
// Safe parameter retrieval. Default values if not defined // Safe parameter retrieval. Default values if not defined
@ -175,7 +174,6 @@ public class SessionRestController {
Session session = this.sessionManager.getSession(sessionId); Session session = this.sessionManager.getSession(sessionId);
if (session != null) { if (session != null) {
JsonObject response = (webRtcStats == true) ? session.withStatsToJson() : session.toJson(); JsonObject response = (webRtcStats == true) ? session.withStatsToJson() : session.toJson();
response.addProperty("recording", this.recordingManager.sessionIsBeingRecorded(sessionId));
return new ResponseEntity<>(response.toString(), getResponseHeaders(), HttpStatus.OK); return new ResponseEntity<>(response.toString(), getResponseHeaders(), HttpStatus.OK);
} else { } else {
Session sessionNotActive = this.sessionManager.getSessionNotActive(sessionId); Session sessionNotActive = this.sessionManager.getSessionNotActive(sessionId);
@ -200,7 +198,6 @@ public class SessionRestController {
JsonArray jsonArray = new JsonArray(); JsonArray jsonArray = new JsonArray();
sessions.forEach(s -> { sessions.forEach(s -> {
JsonObject sessionJson = (webRtcStats == true) ? s.withStatsToJson() : s.toJson(); JsonObject sessionJson = (webRtcStats == true) ? s.withStatsToJson() : s.toJson();
sessionJson.addProperty("recording", this.recordingManager.sessionIsBeingRecorded(s.getSessionId()));
jsonArray.add(sessionJson); jsonArray.add(sessionJson);
}); });
json.addProperty("numberOfElements", sessions.size()); json.addProperty("numberOfElements", sessions.size());