diff --git a/scripts/external/JanusClientConnection.js b/scripts/external/JanusClientConnection.js index 26e2c8fc..f0037a46 100644 --- a/scripts/external/JanusClientConnection.js +++ b/scripts/external/JanusClientConnection.js @@ -409,4 +409,12 @@ JanusClientConnection.prototype.enter_room = function(url) { } }); }; +JanusClientConnection.prototype.leave_room = function(url) { + this.send({ + 'method': 'leave_room', + 'data': { + 'roomId': md5(url) + } + }); +}; diff --git a/scripts/janusweb.js b/scripts/janusweb.js index 04ce2c22..57388444 100644 --- a/scripts/janusweb.js +++ b/scripts/janusweb.js @@ -211,6 +211,7 @@ setTimeout(function() { //setTimeout(elation.bind(this.currentroom, this.currentroom.die), 1000); //this.currentroom.die(); this.currentroom.disable(); + this.leave_room(this.currentroom.url); this.currentroom = false; } this.refresh(); @@ -359,6 +360,11 @@ setTimeout(function() { this.network.enter_room(url); } } + this.leave_room = function(url) { + if (this.network) { + this.network.leave_room(url); + } + } this.onJanusMessage = function(msg) { var method = msg.data.method if (method == 'user_moved') { @@ -455,6 +461,7 @@ setTimeout(function() { if (remote.room !== room) { room.add(remote); + remote.room = room; } if (movedata.dir) {