From bb74ff43d9bf80ffe157619343b0cc948edd2e7d Mon Sep 17 00:00:00 2001 From: Loren Anderson Date: Thu, 16 Mar 2023 14:56:27 -0700 Subject: [PATCH] Twitch + Chat Bugfix - Detect twitch URL properly --- examples/twitch.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/twitch.html b/examples/twitch.html index 7db72d5..12cb9cf 100644 --- a/examples/twitch.html +++ b/examples/twitch.html @@ -137,7 +137,11 @@ function loadIframes(url=false){ } else { var room1 = "https://"+path+"/?push="+roomname+"&webcam&autostart&vd=front&ad=1&transparent&noheader"; } - var room2 = "https://www.twitch.tv/embed/"+twitch+"/chat?parent="+location.hostname; + + var room2 = twitch.startsWith("https://") + ? twitch + : `https://www.twitch.tv/embed/${twitch}/chat?parent=${location.hostname}`; + var iframe = document.createElement("iframe"); iframe.allow = "autoplay;camera;microphone;fullscreen;picture-in-picture;"; iframe.src = room1;