openvidu-server: recording url only defined on ready or failed status

pull/375/head
pabloFuente 2019-08-09 09:34:30 +02:00
parent b3200bfd77
commit 9436315f7d
4 changed files with 11 additions and 8 deletions

View File

@ -190,7 +190,7 @@ public class Recording {
/**
* URL of the recording. You can access the file from there. It is
* <code>null</code> until recording is stopped. If
* <code>null</code> until recording reaches "ready" or "failed" status. 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, this path will be

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. If OpenVidu Server configuration property `openvidu.recording.public-access` is false, this path will be secured with OpenVidu credentials
* URL of the recording. You can access the file from there. It is `null` until recording reaches "ready" or "failed" status. If OpenVidu Server configuration property `openvidu.recording.public-access` is false, this path will be secured with OpenVidu credentials
*/
url: string;

View File

@ -418,9 +418,12 @@ public class RecordingManager {
}
}
Recording recording = new Recording(json);
String recordingUrl = openviduConfig.getFinalUrl() + "recordings/" + recording.getId() + "/"
+ recording.getName() + "." + this.getExtensionFromRecording(recording);
recording.setUrl(recordingUrl);
if (io.openvidu.java.client.Recording.Status.ready.equals(recording.getStatus())
|| io.openvidu.java.client.Recording.Status.failed.equals(recording.getStatus())) {
String recordingUrl = openviduConfig.getFinalUrl() + "recordings/" + recording.getId() + "/"
+ recording.getName() + "." + this.getExtensionFromRecording(recording);
recording.setUrl(recordingUrl);
}
return recording;
}
return null;

View File

@ -2184,7 +2184,7 @@ public class OpenViduTestAppE2eTest {
Assert.assertEquals("Wrong recording session id", session.getSessionId(), recording.getSessionId());
Assert.assertEquals("Wrong recording duration", 0, recording.getDuration(), 0.0001);
Assert.assertEquals("Wrong recording size", 0, recording.getSize());
Assert.assertNotNull("Wrong recording url", recording.getUrl());
Assert.assertNull("Wrong recording url", recording.getUrl());
Assert.assertEquals("Wrong recording output mode", Recording.OutputMode.INDIVIDUAL, recording.getOutputMode());
Assert.assertNull("Wrong recording layout", recording.getRecordingLayout());
Assert.assertNull("Wrong recording custom layout", recording.getCustomLayout());
@ -2208,7 +2208,7 @@ public class OpenViduTestAppE2eTest {
recording.getDuration() > 0);
Assert.assertTrue("Wrong recording size. Excepected > 0 and was " + recording.getSize(),
recording.getSize() > 0);
Assert.assertNull("Wrong recording url. Expected not null and was null", recording.getUrl());
Assert.assertNotNull(recording.getUrl());
Assert.assertEquals("Wrong recording status. Expected ready and was " + recording.getStatus().name(),
Recording.Status.ready, recording.getStatus());
Assert.assertFalse("Session shouldn't be being recorded", session.isBeingRecorded());
@ -2260,7 +2260,7 @@ public class OpenViduTestAppE2eTest {
Assert.assertTrue("Wrong recording duration", recording2.getDuration() > 0);
Assert.assertTrue("Wrong recording size", recording2.getSize() > 0);
Assert.assertNull("Wrong recording url", recording2.getUrl());
Assert.assertNotNull("Wrong recording url", recording2.getUrl());
Assert.assertEquals("Wrong recording status", Recording.Status.ready, recording2.getStatus());
Assert.assertFalse("Session shouldn't be being recorded", session.isBeingRecorded());
Assert.assertFalse("Session.fetch() should return false", session.fetch());