openvidu-server: recording url fix

pull/255/head
pabloFuente 2019-04-15 17:31:26 +02:00
parent c49de8853d
commit 8fd5375608
3 changed files with 9 additions and 11 deletions

View File

@ -20,7 +20,7 @@ const appRoutes: Routes = [
component: LayoutBestFitComponent component: LayoutBestFitComponent
}, },
{ {
path: 'layout-best-fit/:sessionId/:secret/:onlyVideo/:port', path: 'layout-best-fit/:sessionId/:secret/:port/:onlyVideo',
component: LayoutBestFitComponent component: LayoutBestFitComponent
}, },
{ {
@ -28,7 +28,7 @@ const appRoutes: Routes = [
component: LayoutVerticalPresentationComponent component: LayoutVerticalPresentationComponent
}, },
{ {
path: 'layout-vertical-presentation/:sessionId/:secret/:onlyVideo/:port', path: 'layout-vertical-presentation/:sessionId/:secret/:port/:onlyVideo',
component: LayoutVerticalPresentationComponent component: LayoutVerticalPresentationComponent
}, },
{ {
@ -36,7 +36,7 @@ const appRoutes: Routes = [
component: LayoutHorizontalPresentationComponent component: LayoutHorizontalPresentationComponent
}, },
{ {
path: 'layout-horizontal-presentation/:sessionId/:secret/:onlyVideo/:port', path: 'layout-horizontal-presentation/:sessionId/:secret/:port/:onlyVideo',
component: LayoutHorizontalPresentationComponent component: LayoutHorizontalPresentationComponent
} }
]; ];

View File

@ -208,7 +208,6 @@ public class OpenViduServer implements JsonRpcConfigurer {
try { try {
String containerIp = getContainerIp(); String containerIp = getContainerIp();
OpenViduServer.wsUrl = "wss://" + containerIp + ":" + openviduConf.getServerPort(); OpenViduServer.wsUrl = "wss://" + containerIp + ":" + openviduConf.getServerPort();
openviduConf.setFinalUrl("https://" + containerIp + ":" + openviduConf.getServerPort());
} catch (Exception e) { } catch (Exception e) {
log.error("Docker container IP was configured, but there was an error obtaining IP: " log.error("Docker container IP was configured, but there was an error obtaining IP: "
+ e.getClass().getName() + " " + e.getMessage()); + e.getClass().getName() + " " + e.getMessage());
@ -235,8 +234,6 @@ public class OpenViduServer implements JsonRpcConfigurer {
OpenViduServer.wsUrl = publicUrl.replace("http://", "wss://"); OpenViduServer.wsUrl = publicUrl.replace("http://", "wss://");
} }
openviduConf.setFinalUrl(url.toString());
if (!OpenViduServer.wsUrl.startsWith("wss://")) { if (!OpenViduServer.wsUrl.startsWith("wss://")) {
OpenViduServer.wsUrl = "wss://" + OpenViduServer.wsUrl; OpenViduServer.wsUrl = "wss://" + OpenViduServer.wsUrl;
} }
@ -245,7 +242,6 @@ public class OpenViduServer implements JsonRpcConfigurer {
if (OpenViduServer.wsUrl == null) { if (OpenViduServer.wsUrl == null) {
type = "local"; type = "local";
OpenViduServer.wsUrl = "wss://localhost:" + openviduConf.getServerPort(); OpenViduServer.wsUrl = "wss://localhost:" + openviduConf.getServerPort();
openviduConf.setFinalUrl("https://localhost:" + openviduConf.getServerPort());
} }
if (OpenViduServer.wsUrl.endsWith("/")) { if (OpenViduServer.wsUrl.endsWith("/")) {
@ -273,6 +269,8 @@ public class OpenViduServer implements JsonRpcConfigurer {
} }
} }
String finalUrl = OpenViduServer.wsUrl.replaceFirst("wss://", "https://").replaceFirst("ws://", "http://");
openviduConf.setFinalUrl(finalUrl);
httpUrl = openviduConf.getFinalUrl(); httpUrl = openviduConf.getFinalUrl();
log.info("OpenVidu Server using " + type + " URL: [" + OpenViduServer.wsUrl + "]"); log.info("OpenVidu Server using " + type + " URL: [" + OpenViduServer.wsUrl + "]");
} }

View File

@ -446,15 +446,15 @@ public class ComposedRecordingService extends RecordingService {
+ "/layouts/custom" + layout + "?sessionId=" + shortSessionId + "&secret=" + secret; + "/layouts/custom" + layout + "?sessionId=" + shortSessionId + "&secret=" + secret;
} else { } else {
layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-"); layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-");
Integer port = null; int port = startsWithHttp ? 80 : 443;
try { try {
port = new URL(openviduConfig.getOpenViduPublicUrl()).getPort(); port = new URL(openviduConfig.getFinalUrl()).getPort();
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }
finalUrl = (startsWithHttp ? "http" : "https") + "://OPENVIDUAPP:" + secret + "@" + recordingUrl finalUrl = (startsWithHttp ? "http" : "https") + "://OPENVIDUAPP:" + secret + "@" + recordingUrl
+ "/#/layout-" + layout + "/" + shortSessionId + "/" + secret + "/" + !recording.hasAudio() + "/#/layout-" + layout + "/" + shortSessionId + "/" + secret + "/" + port + "/"
+ ((port != null) ? ("/" + port) : ""); + !recording.hasAudio();
} }
return finalUrl; return finalUrl;