diff --git a/openvidu-server/src/angular/frontend/src/app/app.routing.ts b/openvidu-server/src/angular/frontend/src/app/app.routing.ts index f6b861d4..82d4b6a9 100644 --- a/openvidu-server/src/angular/frontend/src/app/app.routing.ts +++ b/openvidu-server/src/angular/frontend/src/app/app.routing.ts @@ -20,7 +20,7 @@ const appRoutes: Routes = [ component: LayoutBestFitComponent }, { - path: 'layout-best-fit/:sessionId/:secret/:onlyVideo/:port', + path: 'layout-best-fit/:sessionId/:secret/:port/:onlyVideo', component: LayoutBestFitComponent }, { @@ -28,7 +28,7 @@ const appRoutes: Routes = [ component: LayoutVerticalPresentationComponent }, { - path: 'layout-vertical-presentation/:sessionId/:secret/:onlyVideo/:port', + path: 'layout-vertical-presentation/:sessionId/:secret/:port/:onlyVideo', component: LayoutVerticalPresentationComponent }, { @@ -36,7 +36,7 @@ const appRoutes: Routes = [ component: LayoutHorizontalPresentationComponent }, { - path: 'layout-horizontal-presentation/:sessionId/:secret/:onlyVideo/:port', + path: 'layout-horizontal-presentation/:sessionId/:secret/:port/:onlyVideo', component: LayoutHorizontalPresentationComponent } ]; diff --git a/openvidu-server/src/main/java/io/openvidu/server/OpenViduServer.java b/openvidu-server/src/main/java/io/openvidu/server/OpenViduServer.java index 597176e3..7449b7db 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/OpenViduServer.java +++ b/openvidu-server/src/main/java/io/openvidu/server/OpenViduServer.java @@ -208,7 +208,6 @@ public class OpenViduServer implements JsonRpcConfigurer { try { String containerIp = getContainerIp(); OpenViduServer.wsUrl = "wss://" + containerIp + ":" + openviduConf.getServerPort(); - openviduConf.setFinalUrl("https://" + containerIp + ":" + openviduConf.getServerPort()); } catch (Exception e) { log.error("Docker container IP was configured, but there was an error obtaining IP: " + e.getClass().getName() + " " + e.getMessage()); @@ -235,8 +234,6 @@ public class OpenViduServer implements JsonRpcConfigurer { OpenViduServer.wsUrl = publicUrl.replace("http://", "wss://"); } - openviduConf.setFinalUrl(url.toString()); - if (!OpenViduServer.wsUrl.startsWith("wss://")) { OpenViduServer.wsUrl = "wss://" + OpenViduServer.wsUrl; } @@ -245,7 +242,6 @@ public class OpenViduServer implements JsonRpcConfigurer { if (OpenViduServer.wsUrl == null) { type = "local"; OpenViduServer.wsUrl = "wss://localhost:" + openviduConf.getServerPort(); - openviduConf.setFinalUrl("https://localhost:" + openviduConf.getServerPort()); } 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(); log.info("OpenVidu Server using " + type + " URL: [" + OpenViduServer.wsUrl + "]"); } diff --git a/openvidu-server/src/main/java/io/openvidu/server/recording/service/ComposedRecordingService.java b/openvidu-server/src/main/java/io/openvidu/server/recording/service/ComposedRecordingService.java index 45b39708..a64ae656 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/recording/service/ComposedRecordingService.java +++ b/openvidu-server/src/main/java/io/openvidu/server/recording/service/ComposedRecordingService.java @@ -446,15 +446,15 @@ public class ComposedRecordingService extends RecordingService { + "/layouts/custom" + layout + "?sessionId=" + shortSessionId + "&secret=" + secret; } else { layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-"); - Integer port = null; + int port = startsWithHttp ? 80 : 443; try { - port = new URL(openviduConfig.getOpenViduPublicUrl()).getPort(); + port = new URL(openviduConfig.getFinalUrl()).getPort(); } catch (MalformedURLException e) { log.error(e.getMessage()); } finalUrl = (startsWithHttp ? "http" : "https") + "://OPENVIDUAPP:" + secret + "@" + recordingUrl - + "/#/layout-" + layout + "/" + shortSessionId + "/" + secret + "/" + !recording.hasAudio() - + ((port != null) ? ("/" + port) : ""); + + "/#/layout-" + layout + "/" + shortSessionId + "/" + secret + "/" + port + "/" + + !recording.hasAudio(); } return finalUrl;