CONNECTION_INTERRUPTED event will now be generated if we've ever been in stable state(we can go into "unstable" state after muting video and connection problems screen will not be displayed).

This commit is contained in:
paweldomas 2015-08-25 12:14:09 +02:00
parent 9a77ddc54c
commit f559bd1ba4
1 changed files with 9 additions and 1 deletions

View File

@ -83,7 +83,10 @@ JingleSessionPC.prototype.doInitialize = function () {
this.hadstuncandidate = false; this.hadstuncandidate = false;
this.hadturncandidate = false; this.hadturncandidate = false;
this.lasticecandidate = false; this.lasticecandidate = false;
// True if reconnect is in progress
this.isreconnect = false; this.isreconnect = false;
// Set to true if the connection was ever stable
this.wasstable = false;
this.peerconnection = new TraceablePeerConnection( this.peerconnection = new TraceablePeerConnection(
this.connection.jingle.ice_config, this.connection.jingle.ice_config,
@ -112,6 +115,10 @@ JingleSessionPC.prototype.doInitialize = function () {
}; };
this.peerconnection.onsignalingstatechange = function (event) { this.peerconnection.onsignalingstatechange = function (event) {
if (!(self && self.peerconnection)) return; if (!(self && self.peerconnection)) return;
console.info("Signaling: " + this.peerconnection.signalingState);
if (self.peerconnection.signalingState === 'stable') {
self.wasstable = true;
}
self.updateModifySourcesQueue(); self.updateModifySourcesQueue();
}; };
/** /**
@ -123,6 +130,7 @@ JingleSessionPC.prototype.doInitialize = function () {
*/ */
this.peerconnection.oniceconnectionstatechange = function (event) { this.peerconnection.oniceconnectionstatechange = function (event) {
if (!(self && self.peerconnection)) return; if (!(self && self.peerconnection)) return;
console.info("Ice: " + self.peerconnection.iceConnectionState);
self.updateModifySourcesQueue(); self.updateModifySourcesQueue();
switch (self.peerconnection.iceConnectionState) { switch (self.peerconnection.iceConnectionState) {
case 'connected': case 'connected':
@ -136,7 +144,7 @@ JingleSessionPC.prototype.doInitialize = function () {
case 'disconnected': case 'disconnected':
self.isreconnect = true; self.isreconnect = true;
// Informs interested parties that the connection has been interrupted. // Informs interested parties that the connection has been interrupted.
if (self.peerconnection.signalingState === 'stable') if (self.wasstable)
self.eventEmitter.emit(XMPPEvents.CONNECTION_INTERRUPTED); self.eventEmitter.emit(XMPPEvents.CONNECTION_INTERRUPTED);
break; break;
case 'failed': case 'failed':