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

View File

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

View File

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

View File

@ -64,7 +64,7 @@ public class Recording {
this.hasVideo = (boolean) json.get("hasVideo");
this.status = Status.valueOf((String) json.get("status"));
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() {
@ -87,7 +87,7 @@ public class Recording {
return this.recordingProperties.name();
}
public RecordingLayout getLayout() {
public RecordingLayout getRecordingLayout() {
return this.recordingProperties.recordingLayout();
}
@ -156,7 +156,7 @@ public class Recording {
JSONObject json = new JSONObject();
json.put("id", this.id);
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("createdAt", this.createdAt);
json.put("size", this.size);