openvidu-server: recording entities will always have url param defined

pull/375/head
pabloFuente 2019-08-08 17:16:59 +02:00
parent bca34e150d
commit d736dd2eef
3 changed files with 19 additions and 4 deletions

View File

@ -190,10 +190,11 @@ public class Recording {
/**
* URL of the recording. You can access the file from there. It is
* <code>null</code> until recording is stopped or if
* <code>null</code> until recording is stopped. If
* <a href="https://openvidu.io/docs/reference-docs/openvidu-server-params/"
* target="_blank">OpenVidu Server configuration</a> property
* <code>openvidu.recording.public-access</code> is false
* <code>openvidu.recording.public-access</code> is false, this path will be
* secured with OpenVidu credentials
*/
public String getUrl() {
return url;

View File

@ -49,7 +49,7 @@ export class Recording {
duration = 0;
/**
* URL of the recording. You can access the file from there. It is `null` until recording is stopped or if OpenVidu Server configuration property `openvidu.recording.public-access` is false
* URL of the recording. You can access the file from there. It is `null` until recording is stopped. If OpenVidu Server configuration property `openvidu.recording.public-access` is false, this path will be secured with OpenVidu credentials
*/
url: string;

View File

@ -417,11 +417,25 @@ public class RecordingManager {
log.error("Exception while closing FileReader: {}", e.getMessage());
}
}
return new Recording(json);
Recording recording = new Recording(json);
String recordingUrl = openviduConfig.getFinalUrl() + "recordings/" + recording.getId() + "/"
+ recording.getName() + "." + this.getExtensionFromRecording(recording);
recording.setUrl(recordingUrl);
return recording;
}
return null;
}
public String getExtensionFromRecording(Recording recording) {
if (io.openvidu.java.client.Recording.OutputMode.INDIVIDUAL.equals(recording.getOutputMode())) {
return "zip";
} else if (recording.hasVideo()) {
return "mp4";
} else {
return "webm";
}
}
public void initAutomaticRecordingStopThread(final Session session) {
final String recordingId = this.sessionsRecordings.get(session.getSessionId()).getId();
ScheduledFuture<?> future = this.automaticRecordingStopExecutor.schedule(() -> {