openvidu-server: "layout" to "recordingLayout"

pull/73/head
pabloFuente 2018-04-25 11:08:55 +02:00
parent 0db5498a0b
commit 984dbcee06
4 changed files with 18 additions and 20 deletions

View File

@ -51,7 +51,7 @@ public class CDREvent implements Comparable<CDREvent> {
private String name; private String name;
private Boolean hasAudio; private Boolean hasAudio;
private Boolean hasVideo; private Boolean hasVideo;
private RecordingLayout layout; private RecordingLayout recordingLayout;
public CDREvent(String eventName, CDREvent event) { public CDREvent(String eventName, CDREvent event) {
this(eventName, event.participant, event.sessionId, event.mediaOptions, event.receivingFrom, event.startTime, event.reason); this(eventName, event.participant, event.sessionId, event.mediaOptions, event.receivingFrom, event.startTime, event.reason);
@ -88,7 +88,7 @@ public class CDREvent implements Comparable<CDREvent> {
this.size = recording.getSize(); this.size = recording.getSize();
this.hasAudio = recording.hasAudio(); this.hasAudio = recording.hasAudio();
this.hasVideo = recording.hasVideo(); this.hasVideo = recording.hasVideo();
this.layout = recording.getLayout(); this.recordingLayout = recording.getRecordingLayout();
} }
public CDREvent(String eventName, Participant participant, String sessionId) { public CDREvent(String eventName, Participant participant, String sessionId) {
@ -166,8 +166,8 @@ public class CDREvent implements Comparable<CDREvent> {
if (this.hasVideo != null) { if (this.hasVideo != null) {
json.put("hasVideo", this.hasVideo); json.put("hasVideo", this.hasVideo);
} }
if (this.layout != null) { if (this.recordingLayout != null) {
json.put("layout", this.layout.name()); json.put("recordingLayout", this.recordingLayout.name());
} }
JSONObject root = new JSONObject(); JSONObject root = new JSONObject();

View File

@ -40,8 +40,8 @@ import io.openvidu.server.recording.Recording;
* - 'participantLeft': {sessionId, timestamp, participantId, startTime, endTime, duration, reason} * - 'participantLeft': {sessionId, timestamp, participantId, startTime, endTime, duration, reason}
* - 'webrtcConnectionCreated' {sessionId, timestamp, participantId, connection, [receivingFrom], audioEnabled, videoEnabled, [videoSource], [videoFramerate]} * - 'webrtcConnectionCreated' {sessionId, timestamp, participantId, connection, [receivingFrom], audioEnabled, videoEnabled, [videoSource], [videoFramerate]}
* - 'webrtcConnectionDestroyed' {sessionId, timestamp, participantId, startTime, endTime, duration, connection, [receivingFrom], audioEnabled, videoEnabled, [videoSource], [videoFramerate], reason} * - 'webrtcConnectionDestroyed' {sessionId, timestamp, participantId, startTime, endTime, duration, connection, [receivingFrom], audioEnabled, videoEnabled, [videoSource], [videoFramerate], reason}
* - 'recordingStarted' {sessionId, timestamp, id, name, hasAudio, hasVideo, size} * - 'recordingStarted' {sessionId, timestamp, id, name, hasAudio, hasVideo, recordingLayout, size}
* - 'recordingStopped' {sessionId, timestamp, id, name, hasAudio, hasVideo, size} * - 'recordingStopped' {sessionId, timestamp, id, name, hasAudio, hasVideo, recordingLayout, size}
* *
* PROPERTIES VALUES: * PROPERTIES VALUES:
* *
@ -61,6 +61,7 @@ import io.openvidu.server.recording.Recording;
* - name: string * - name: string
* - hasAudio: boolean * - hasAudio: boolean
* - hasVideo: boolean * - hasVideo: boolean
* - recordingLayout: string
* - size: number * - size: number
* - webrtcConnectionDestroyed.reason: "unsubscribe", "unpublish", "disconnect", "networkDisconnect", "openviduServerDestroyed" * - webrtcConnectionDestroyed.reason: "unsubscribe", "unpublish", "disconnect", "networkDisconnect", "openviduServerDestroyed"
* - participantLeft.reason: "unsubscribe", "unpublish", "disconnect", "networkDisconnect", "openviduServerDestroyed" * - participantLeft.reason: "unsubscribe", "unpublish", "disconnect", "networkDisconnect", "openviduServerDestroyed"

View File

@ -394,26 +394,23 @@ public class ComposedRecordingService {
// Cannot delete an active recording // Cannot delete an active recording
return HttpStatus.CONFLICT; return HttpStatus.CONFLICT;
} }
Recording recording = getRecordingFromHost(recordingId);
if (recording == null) {
return HttpStatus.NOT_FOUND;
}
String name = getRecordingFromHost(recordingId).getName(); String name = getRecordingFromHost(recordingId).getName();
File folder = new File(this.openviduConfig.getOpenViduRecordingPath()); File folder = new File(this.openviduConfig.getOpenViduRecordingPath());
File[] files = folder.listFiles(); File[] files = folder.listFiles();
int numFilesDeleted = 0;
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
if (files[i].isFile() && isFileFromRecording(files[i], recordingId, name)) { if (files[i].isFile() && isFileFromRecording(files[i], recordingId, name)) {
files[i].delete(); files[i].delete();
numFilesDeleted++;
} }
} }
HttpStatus status; return HttpStatus.NO_CONTENT;
if (numFilesDeleted == 3) {
status = HttpStatus.NO_CONTENT;
} else {
status = HttpStatus.NOT_FOUND;
}
return status;
} }
private Recording getRecordingFromEntityFile(File file) { private Recording getRecordingFromEntityFile(File file) {
@ -475,7 +472,7 @@ public class ComposedRecordingService {
String location = OpenViduServer.publicUrl.replaceFirst("wss://", ""); String location = OpenViduServer.publicUrl.replaceFirst("wss://", "");
String layout, finalUrl; String layout, finalUrl;
if (RecordingLayout.CUSTOM.equals(recording.getLayout())) { if (RecordingLayout.CUSTOM.equals(recording.getRecordingLayout())) {
layout = recording.getCustomLayout(); layout = recording.getCustomLayout();
layout = layout.startsWith("/") ? layout.substring(1) : layout; layout = layout.startsWith("/") ? layout.substring(1) : layout;
layout = layout.endsWith("/") ? layout.substring(0, layout.length() - 1) : layout; layout = layout.endsWith("/") ? layout.substring(0, layout.length() - 1) : layout;
@ -483,7 +480,7 @@ public class ComposedRecordingService {
finalUrl = "https://OPENVIDUAPP:" + secret + "@" + location + "/layouts/custom/" + layout + "/?sessionId=" finalUrl = "https://OPENVIDUAPP:" + secret + "@" + location + "/layouts/custom/" + layout + "/?sessionId="
+ shortSessionId + "&secret=" + secret; + shortSessionId + "&secret=" + secret;
} else { } else {
layout = recording.getLayout().name().toLowerCase().replaceAll("_", "-"); layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-");
finalUrl = "https://OPENVIDUAPP:" + secret + "@" + location + "/#/layout-" + layout + "/" + shortSessionId finalUrl = "https://OPENVIDUAPP:" + secret + "@" + location + "/#/layout-" + layout + "/" + shortSessionId
+ "/" + secret; + "/" + secret;
} }

View File

@ -64,7 +64,7 @@ public class Recording {
this.hasVideo = (boolean) json.get("hasVideo"); this.hasVideo = (boolean) json.get("hasVideo");
this.status = Status.valueOf((String) json.get("status")); this.status = Status.valueOf((String) json.get("status"));
this.recordingProperties = new RecordingProperties.Builder().name((String) json.get("name")) this.recordingProperties = new RecordingProperties.Builder().name((String) json.get("name"))
.recordingLayout(RecordingLayout.valueOf((String) json.get("layout"))).build(); .recordingLayout(RecordingLayout.valueOf((String) json.get("recordingLayout"))).build();
} }
public Status getStatus() { public Status getStatus() {
@ -87,7 +87,7 @@ public class Recording {
return this.recordingProperties.name(); return this.recordingProperties.name();
} }
public RecordingLayout getLayout() { public RecordingLayout getRecordingLayout() {
return this.recordingProperties.recordingLayout(); return this.recordingProperties.recordingLayout();
} }
@ -156,7 +156,7 @@ public class Recording {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("id", this.id); json.put("id", this.id);
json.put("name", this.recordingProperties.name()); json.put("name", this.recordingProperties.name());
json.put("layout", this.recordingProperties.recordingLayout().name()); json.put("recordingLayout", this.recordingProperties.recordingLayout().name());
json.put("sessionId", this.sessionId); json.put("sessionId", this.sessionId);
json.put("createdAt", this.createdAt); json.put("createdAt", this.createdAt);
json.put("size", this.size); json.put("size", this.size);