From 4ae0e8ad1542d6b80cae519714ff68d4704683e4 Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Tue, 25 Jan 2022 08:51:39 +0100 Subject: [PATCH] [mirotalksfu] - add survey on leave room --- public/js/Room.js | 15 +++++++++++++-- public/js/{newroom.js => newRoom.js} | 0 2 files changed, 13 insertions(+), 2 deletions(-) rename public/js/{newroom.js => newRoom.js} (100%) diff --git a/public/js/Room.js b/public/js/Room.js index 6903d35..0daca1c 100644 --- a/public/js/Room.js +++ b/public/js/Room.js @@ -10,6 +10,7 @@ const swalImageUrl = '../images/pricing-illustration.svg'; const url = { ipLookup: 'https://extreme-ip-lookup.com/json/?key=demo', + survey: 'https://www.questionpro.com/t/AUs7VZq02P', }; const _PEER = { @@ -24,6 +25,8 @@ const _PEER = { sendMsg: '', }; +const surveyAvtive = true; + let participantsCount = 0; let rc = null; @@ -170,7 +173,7 @@ async function initEnumerateDevices() { }); if (!isAudioAllowed && !isVideoAllowed) { - window.location.href = `/permission?room_id=${room_id}&message=Not allowed both Audio and Video`; + openURL(`/permission?room_id=${room_id}&message=Not allowed both Audio and Video`); } else { hide(loadingDiv); getPeerGeoLocation(); @@ -985,7 +988,11 @@ function handleRoomClientEvents() { }); rc.on(RoomClient.EVENTS.exitRoom, () => { console.log('Room Client leave room'); - window.location.href = '/newroom'; + if (surveyAvtive) { + openURL(url.survey); + } else { + openURL('/newroom'); + } }); } @@ -1055,6 +1062,10 @@ function isImageURL(url) { return url.match(/\.(jpeg|jpg|gif|png|tiff|bmp)$/) != null; } +function openURL(url) { + window.location.href = url; +} + // #################################################### // HANDLE WHITEBOARD // #################################################### diff --git a/public/js/newroom.js b/public/js/newRoom.js similarity index 100% rename from public/js/newroom.js rename to public/js/newRoom.js