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(); 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) });