From d16b12345829a6a18889dd1e22528476581ac37d Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 29 Sep 2019 12:19:12 +0200 Subject: Fix participant ID being reset (cherry-picked from janus-gateway git commit 0eeae4e). --- website/mic.js | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/website/mic.js b/website/mic.js index f948f32..4ab1c37 100644 --- a/website/mic.js +++ b/website/mic.js @@ -271,25 +271,27 @@ $(document).ready(function() { if(event != undefined && event != null) { if(event === "joined") { // Successfully joined, negotiate WebRTC now - myid = msg["id"]; - Janus.log("Successfully joined room " + msg["room"] + " with ID " + myid); - if(!webrtcUp) { - webrtcUp = true; - // Publish our stream - mixertest.createOffer( - { - media: { video: false}, // This is an audio only room - success: function(jsep) { - Janus.debug("Got SDP!"); - Janus.debug(jsep); - var publish = { "request": "configure", "muted": true }; - mixertest.send({"message": publish, "jsep": jsep}); - }, - error: function(error) { - Janus.error("WebRTC error:", error); - bootbox.alert("WebRTC error... " + JSON.stringify(error)); - } - }); + if(msg["id"]) { + myid = msg["id"]; + Janus.log("Successfully joined room " + msg["room"] + " with ID " + myid); + if(!webrtcUp) { + webrtcUp = true; + // Publish our stream + mixertest.createOffer( + { + media: { video: false}, // This is an audio only room + success: function(jsep) { + Janus.debug("Got SDP!"); + Janus.debug(jsep); + var publish = { "request": "configure", "muted": true }; + mixertest.send({"message": publish, "jsep": jsep}); + }, + error: function(error) { + Janus.error("WebRTC error:", error); + bootbox.alert("WebRTC error... " + JSON.stringify(error)); + } + }); + } } // Any room participant? if(msg["participants"] !== undefined && msg["participants"] !== null) { -- cgit v1.2.3