From 162b11213dd49400d7cafe713e43f5de9fd6eb36 Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Sun, 4 Dec 2022 20:09:46 +0300 Subject: [PATCH] Allow JS player URL to http --- www/video-rtc.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/www/video-rtc.js b/www/video-rtc.js index 2a2f8924..f0219fe9 100644 --- a/www/video-rtc.js +++ b/www/video-rtc.js @@ -188,12 +188,11 @@ class VideoRTC extends HTMLElement { * @param {string|URL} value */ set src(value) { - if (typeof value === "string") { - if (value.startsWith("/")) { - value = "ws" + location.origin.substring(4) + value; - } else if (value.startsWith("http")) { - value = "ws" + value.substring(4); - } + if (typeof value !== "string") value = value.toString(); + if (value.startsWith("http")) { + value = "ws" + value.substring(4); + } else if (value.startsWith("/")) { + value = "ws" + location.origin.substring(4) + value; } this.url = value;