mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: remove getShortSessionId from RecordingService (useless)
parent
88e3029dda
commit
8084acefcd
|
@ -151,7 +151,7 @@ public class ComposedRecordingService extends RecordingService {
|
|||
|
||||
List<String> envs = new ArrayList<>();
|
||||
|
||||
String layoutUrl = this.getLayoutUrl(recording, this.getShortSessionId(session));
|
||||
String layoutUrl = this.getLayoutUrl(recording);
|
||||
|
||||
envs.add("URL=" + layoutUrl);
|
||||
envs.add("ONLY_VIDEO=" + !properties.hasAudio());
|
||||
|
@ -471,7 +471,7 @@ public class ComposedRecordingService extends RecordingService {
|
|||
throw e;
|
||||
}
|
||||
|
||||
private String getLayoutUrl(Recording recording, String shortSessionId) throws OpenViduException {
|
||||
private String getLayoutUrl(Recording recording) throws OpenViduException {
|
||||
String secret = openviduConfig.getOpenViduSecret();
|
||||
|
||||
// Check if "customLayout" property defines a final URL
|
||||
|
@ -482,7 +482,7 @@ public class ComposedRecordingService extends RecordingService {
|
|||
URL url = new URL(layout);
|
||||
log.info("\"customLayout\" property has a URL format ({}). Using it to connect to custom layout",
|
||||
url.toString());
|
||||
return this.processCustomLayoutUrlFormat(url, shortSessionId);
|
||||
return this.processCustomLayoutUrlFormat(url, recording.getSessionId());
|
||||
} catch (MalformedURLException e) {
|
||||
String layoutPath = openviduConfig.getOpenviduRecordingCustomLayout() + layout;
|
||||
layoutPath = layoutPath.endsWith("/") ? layoutPath : (layoutPath + "/");
|
||||
|
@ -530,7 +530,7 @@ public class ComposedRecordingService extends RecordingService {
|
|||
}
|
||||
layout += "/index.html";
|
||||
finalUrl = (startsWithHttp ? "http" : "https") + "://OPENVIDUAPP:" + secret + "@" + recordingUrl
|
||||
+ "/layouts/custom" + layout + "?sessionId=" + shortSessionId + "&secret=" + secret;
|
||||
+ "/layouts/custom" + layout + "?sessionId=" + recording.getSessionId() + "&secret=" + secret;
|
||||
} else {
|
||||
layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-");
|
||||
int port = startsWithHttp ? 80 : 443;
|
||||
|
@ -540,8 +540,7 @@ public class ComposedRecordingService extends RecordingService {
|
|||
log.error(e.getMessage());
|
||||
}
|
||||
finalUrl = (startsWithHttp ? "http" : "https") + "://OPENVIDUAPP:" + secret + "@" + recordingUrl
|
||||
+ "/#/layout-" + layout + "/" + shortSessionId + "/" + secret + "/" + port + "/"
|
||||
+ !recording.hasAudio();
|
||||
+ "/#/layout-" + layout + "/" + recording.getSessionId() + "/" + secret + "/" + port + "/" + !recording.hasAudio();
|
||||
}
|
||||
|
||||
return finalUrl;
|
||||
|
|
|
@ -388,18 +388,16 @@ public class RecordingManager {
|
|||
return this.getAllRecordingsFromHost();
|
||||
}
|
||||
|
||||
public String getFreeRecordingId(String sessionId, String shortSessionId) {
|
||||
public String getFreeRecordingId(String sessionId) {
|
||||
Set<String> recordingIds = this.getRecordingIdsFromHost();
|
||||
String recordingId = shortSessionId;
|
||||
String recordingId = sessionId;
|
||||
boolean isPresent = recordingIds.contains(recordingId);
|
||||
int i = 1;
|
||||
|
||||
while (isPresent) {
|
||||
recordingId = shortSessionId + "-" + i;
|
||||
recordingId = sessionId + "-" + i;
|
||||
i++;
|
||||
isPresent = recordingIds.contains(recordingId);
|
||||
}
|
||||
|
||||
return recordingId;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,8 +136,7 @@ public abstract class RecordingService {
|
|||
*/
|
||||
protected PropertiesRecordingId setFinalRecordingNameAndGetFreeRecordingId(Session session,
|
||||
RecordingProperties properties) {
|
||||
String recordingId = this.recordingManager.getFreeRecordingId(session.getSessionId(),
|
||||
this.getShortSessionId(session));
|
||||
String recordingId = this.recordingManager.getFreeRecordingId(session.getSessionId());
|
||||
if (properties.name() == null || properties.name().isEmpty()) {
|
||||
// No name provided for the recording file. Use recordingId
|
||||
RecordingProperties.Builder builder = new RecordingProperties.Builder().name(recordingId)
|
||||
|
@ -172,11 +171,6 @@ public abstract class RecordingService {
|
|||
}
|
||||
}
|
||||
|
||||
protected String getShortSessionId(Session session) {
|
||||
return session.getSessionId().substring(session.getSessionId().lastIndexOf('/') + 1,
|
||||
session.getSessionId().length());
|
||||
}
|
||||
|
||||
protected OpenViduException failStartRecording(Session session, Recording recording, String errorMessage) {
|
||||
log.error("Recording start failed for session {}: {}", session.getSessionId(), errorMessage);
|
||||
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
||||
|
|
Loading…
Reference in New Issue