From 4550c88fdc20b87adc9acc6755955cc05b03243c Mon Sep 17 00:00:00 2001 From: Seungmin Kim <8457324+ehfd@users.noreply.github.com> Date: Sat, 21 Sep 2024 13:47:56 +0900 Subject: [PATCH] Fix issues with relative path --- addons/gst-web/src/app.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/gst-web/src/app.js b/addons/gst-web/src/app.js index cfdfdbc9..e98b29a3 100644 --- a/addons/gst-web/src/app.js +++ b/addons/gst-web/src/app.js @@ -369,10 +369,12 @@ if (audioElement === null) { // WebRTC entrypoint, connect to the signalling server /*global WebRTCDemoSignalling, WebRTCDemo*/ +var pathname = window.location.pathname; +pathname = pathname.slice(0, pathname.lastIndexOf("/") + 1); var protocol = (location.protocol == "http:" ? "ws://" : "wss://"); -var signalling = new WebRTCDemoSignalling(new URL(protocol + window.location.host + "/" + app.appName + "/signalling/")); +var signalling = new WebRTCDemoSignalling(new URL(protocol + window.location.host + pathname + app.appName + "/signalling/")); var webrtc = new WebRTCDemo(signalling, videoElement, 1); -var audio_signalling = new WebRTCDemoSignalling(new URL(protocol + window.location.host + "/" + app.appName + "/signalling/")); +var audio_signalling = new WebRTCDemoSignalling(new URL(protocol + window.location.host + pathname + app.appName + "/signalling/")); var audio_webrtc = new WebRTCDemo(audio_signalling, audioElement, 3); // Function to add timestamp to logs.