mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: openvidu.recording.composed-url property
parent
288b05425a
commit
c49de8853d
|
@ -16,27 +16,27 @@ const appRoutes: Routes = [
|
|||
component: SessionDetailsComponent
|
||||
},
|
||||
{
|
||||
path: 'layout-best-fit/:sessionId/:secret',
|
||||
path: 'layout-best-fit/:sessionId/:secret/:port',
|
||||
component: LayoutBestFitComponent
|
||||
},
|
||||
{
|
||||
path: 'layout-best-fit/:sessionId/:secret/:onlyVideo',
|
||||
path: 'layout-best-fit/:sessionId/:secret/:onlyVideo/:port',
|
||||
component: LayoutBestFitComponent
|
||||
},
|
||||
{
|
||||
path: 'layout-vertical-presentation/:sessionId/:secret',
|
||||
path: 'layout-vertical-presentation/:sessionId/:secret/:port',
|
||||
component: LayoutVerticalPresentationComponent
|
||||
},
|
||||
{
|
||||
path: 'layout-vertical-presentation/:sessionId/:secret/:onlyVideo',
|
||||
path: 'layout-vertical-presentation/:sessionId/:secret/:onlyVideo/:port',
|
||||
component: LayoutVerticalPresentationComponent
|
||||
},
|
||||
{
|
||||
path: 'layout-horizontal-presentation/:sessionId/:secret',
|
||||
path: 'layout-horizontal-presentation/:sessionId/:secret/:port',
|
||||
component: LayoutHorizontalPresentationComponent
|
||||
},
|
||||
{
|
||||
path: 'layout-horizontal-presentation/:sessionId/:secret/:onlyVideo',
|
||||
path: 'layout-horizontal-presentation/:sessionId/:secret/:onlyVideo/:port',
|
||||
component: LayoutHorizontalPresentationComponent
|
||||
}
|
||||
];
|
||||
|
|
|
@ -29,6 +29,7 @@ export class LayoutBaseComponent implements OnInit, OnDestroy {
|
|||
sessionId: string;
|
||||
secret: string;
|
||||
onlyVideo = false;
|
||||
port: number;
|
||||
|
||||
session: Session;
|
||||
subscribers: Subscriber[] = [];
|
||||
|
@ -46,6 +47,9 @@ export class LayoutBaseComponent implements OnInit, OnDestroy {
|
|||
if (params.onlyVideo != null) {
|
||||
this.onlyVideo = JSON.parse(params.onlyVideo);
|
||||
}
|
||||
if (params.port != null) {
|
||||
this.port = params.port;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -101,8 +105,8 @@ export class LayoutBaseComponent implements OnInit, OnDestroy {
|
|||
this.updateLayout(changeFixedRatio);
|
||||
});
|
||||
|
||||
const port = !!location.port ? (':' + location.port) : '';
|
||||
const token = 'wss://' + location.hostname + port + '?sessionId=' + this.sessionId + '&secret=' + this.secret + '&recorder=true';
|
||||
const p = !!this.port ? (':' + this.port) : (!!location.port ? (':' + location.port) : '');
|
||||
const token = 'wss://' + location.hostname + p + '?sessionId=' + this.sessionId + '&secret=' + this.secret + '&recorder=true';
|
||||
this.session.connect(token)
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
|
|
|
@ -63,6 +63,9 @@ public class OpenviduConfig {
|
|||
@Value("${openvidu.recording.autostop-timeout}")
|
||||
private int openviduRecordingAutostopTimeout;
|
||||
|
||||
@Value("${openvidu.recording.composed-url}")
|
||||
private String openviduRecordingComposedUrl;
|
||||
|
||||
@Value("${openvidu.streams.video.max-recv-bandwidth}")
|
||||
private int openviduStreamsVideoMaxRecvBandwidth;
|
||||
|
||||
|
@ -193,6 +196,10 @@ public class OpenviduConfig {
|
|||
return this.openviduRecordingNotification;
|
||||
}
|
||||
|
||||
public String getOpenViduRecordingComposedUrl() {
|
||||
return this.openviduRecordingComposedUrl;
|
||||
}
|
||||
|
||||
public OpenViduRole[] getRolesFromRecordingNotification() {
|
||||
OpenViduRole[] roles;
|
||||
switch (this.openviduRecordingNotification) {
|
||||
|
|
|
@ -19,6 +19,8 @@ package io.openvidu.server.recording.service;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -417,9 +419,22 @@ public class ComposedRecordingService extends RecordingService {
|
|||
|
||||
private String getLayoutUrl(Recording recording, String shortSessionId) {
|
||||
String secret = openviduConfig.getOpenViduSecret();
|
||||
String location = OpenViduServer.wsUrl.replaceFirst("wss://", "");
|
||||
String layout, finalUrl;
|
||||
boolean recordingUrlDefined = openviduConfig.getOpenViduRecordingComposedUrl() != null
|
||||
&& !openviduConfig.getOpenViduRecordingComposedUrl().isEmpty();
|
||||
String recordingUrl = recordingUrlDefined ? openviduConfig.getOpenViduRecordingComposedUrl()
|
||||
: OpenViduServer.wsUrl;
|
||||
recordingUrl = recordingUrl.replaceFirst("wss://", "").replaceFirst("https://", "");
|
||||
boolean startsWithHttp = recordingUrl.startsWith("http://") || recordingUrl.startsWith("ws://");
|
||||
|
||||
if (startsWithHttp) {
|
||||
recordingUrl = recordingUrl.replaceFirst("http://", "").replaceFirst("ws://", "");
|
||||
}
|
||||
|
||||
if (recordingUrl.endsWith("/")) {
|
||||
recordingUrl = recordingUrl.substring(0, recordingUrl.length() - 1);
|
||||
}
|
||||
|
||||
String layout, finalUrl;
|
||||
if (RecordingLayout.CUSTOM.equals(recording.getRecordingLayout())) {
|
||||
layout = recording.getCustomLayout();
|
||||
if (!layout.isEmpty()) {
|
||||
|
@ -427,12 +442,19 @@ public class ComposedRecordingService extends RecordingService {
|
|||
layout = layout.endsWith("/") ? layout.substring(0, layout.length() - 1) : layout;
|
||||
}
|
||||
layout += "/index.html";
|
||||
finalUrl = "https://OPENVIDUAPP:" + secret + "@" + location + "/layouts/custom" + layout + "?sessionId="
|
||||
+ shortSessionId + "&secret=" + secret;
|
||||
finalUrl = (startsWithHttp ? "http" : "https") + "://OPENVIDUAPP:" + secret + "@" + recordingUrl
|
||||
+ "/layouts/custom" + layout + "?sessionId=" + shortSessionId + "&secret=" + secret;
|
||||
} else {
|
||||
layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-");
|
||||
finalUrl = "https://OPENVIDUAPP:" + secret + "@" + location + "/#/layout-" + layout + "/" + shortSessionId
|
||||
+ "/" + secret + "/" + !recording.hasAudio();
|
||||
Integer port = null;
|
||||
try {
|
||||
port = new URL(openviduConfig.getOpenViduPublicUrl()).getPort();
|
||||
} catch (MalformedURLException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
finalUrl = (startsWithHttp ? "http" : "https") + "://OPENVIDUAPP:" + secret + "@" + recordingUrl
|
||||
+ "/#/layout-" + layout + "/" + shortSessionId + "/" + secret + "/" + !recording.hasAudio()
|
||||
+ ((port != null) ? ("/" + port) : "");
|
||||
}
|
||||
|
||||
return finalUrl;
|
||||
|
|
|
@ -65,6 +65,12 @@
|
|||
"description": "Timeout in seconds for automatically stopping the recording of a session when last user disconnects or when it starts and no user is publishing (only if RecordingMode.MANUAL)",
|
||||
"defaultValue": 120
|
||||
},
|
||||
{
|
||||
"name": "openvidu.recording.composed-url",
|
||||
"type": "java.lang.String",
|
||||
"description": "URL where the composed-video recording dockerized Chrome will connect to receive published videos",
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "coturn.sqlite",
|
||||
"type": "java.lang.String",
|
||||
|
|
|
@ -21,6 +21,7 @@ openvidu.recording.public-access: false
|
|||
openvidu.recording.notification: publisher_moderator
|
||||
openvidu.recording.custom-layout: /opt/openvidu/custom-layout
|
||||
openvidu.recording.autostop-timeout: 120
|
||||
openvidu.recording.composed-url:
|
||||
|
||||
openvidu.streams.video.max-recv-bandwidth: 1000
|
||||
openvidu.streams.video.min-recv-bandwidth: 300
|
||||
|
|
Loading…
Reference in New Issue