From 5f92aedffe32718bd036690fd36ec599a964691f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 15 May 2019 15:19:58 +0200 Subject: [PATCH 1/2] Fix video status not kept after forced reconnections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a reconnection is forced the call is left and then joined again. In that case the initial adjustments done when joining a call should not be done again. Signed-off-by: Daniel Calviño Sánchez --- js/app.js | 16 ++++++++++++++++ js/embedded.js | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/js/app.js b/js/app.js index 560700bad73..1e5188f0826 100644 --- a/js/app.js +++ b/js/app.js @@ -617,6 +617,16 @@ }.bind(this)); this.signaling.on('joinCall', function() { + // Do not perform the initial adjustments when joining a call + // again due to a forced reconnection. + if (this._reconnectCallToken === this.activeRoom.get('token')) { + delete this._reconnectCallToken; + + return; + } + + delete this._reconnectCallToken; + // Disable video when joining a call in a room with more than 5 // participants. var participants = this.activeRoom.get('participants'); @@ -632,6 +642,12 @@ } }.bind(this)); + this.signaling.on('leaveCall', function (token, reconnect) { + if (reconnect) { + this._reconnectCallToken = token; + } + }.bind(this)); + $(window).unload(function () { this.connection.leaveCurrentRoom(); this.signaling.disconnect(); diff --git a/js/embedded.js b/js/embedded.js index 59a15662138..9ec6f69682e 100644 --- a/js/embedded.js +++ b/js/embedded.js @@ -137,6 +137,16 @@ }.bind(this)); this.signaling.on('joinCall', function() { + // Do not perform the initial adjustments when joining a call + // again due to a forced reconnection. + if (this._reconnectCallToken === this.activeRoom.get('token')) { + delete this._reconnectCallToken; + + return; + } + + delete this._reconnectCallToken; + // Disable video when joining a call in a room with more than 5 // participants. var participants = this.activeRoom.get('participants'); @@ -152,6 +162,12 @@ } }.bind(this)); + this.signaling.on('leaveCall', function (token, reconnect) { + if (reconnect) { + this._reconnectCallToken = token; + } + }.bind(this)); + $(window).unload(function () { this.connection.leaveCurrentRoom(); this.signaling.disconnect(); From ccc6c91f525729d7198898a2b6f431f2979d0bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 15 May 2019 16:49:13 +0200 Subject: [PATCH 2/2] Fix call flags not kept after forced reconnections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When joining a call again due to a forced reconnection the same flags used when originally joining the call should be provided again; otherwise, if no flags are provided, the default flags would be used by the server, which may not match the real call flags. Signed-off-by: Daniel Calviño Sánchez --- js/signaling.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/signaling.js b/js/signaling.js index 632d008c67c..87ccccbdd08 100644 --- a/js/signaling.js +++ b/js/signaling.js @@ -70,6 +70,7 @@ this.sessionId = ''; this.currentRoomToken = null; this.currentCallToken = null; + this.currentCallFlags = null; this.handlers = {}; this.features = {}; this.pendingChatRequests = []; @@ -136,6 +137,7 @@ OCA.Talk.Signaling.Base.prototype.disconnect = function() { this.sessionId = ''; this.currentCallToken = null; + this.currentCallFlags = null; }; OCA.Talk.Signaling.Base.prototype.hasFeature = function(feature) { @@ -173,6 +175,7 @@ if (this.currentCallToken) { this.leaveCall(this.currentCallToken); this.currentCallToken = null; + this.currentCallFlags = null; } }; @@ -232,9 +235,10 @@ this._runPendingChatRequests(); if (this.currentCallToken === token) { // We were in this call before, join again. - this.joinCall(token); + this.joinCall(token, this.currentCallFlags); } else { this.currentCallToken = null; + this.currentCallFlags = null; } this._joinRoomSuccess(token, result.ocs.data.sessionId); }.bind(this), @@ -311,6 +315,7 @@ }, success: function () { this.currentCallToken = token; + this.currentCallFlags = flags; this._trigger('joinCall', [token]); this._joinCallSuccess(token); }.bind(this), @@ -341,6 +346,7 @@ // We left the current call. if (!keepToken && token === this.currentCallToken) { this.currentCallToken = null; + this.currentCallFlags = null; } }.bind(this) });