Avoid calling screenshare viewer exit twice and handle any possible exception

This commit is contained in:
prlanzarin 2018-09-11 19:40:13 +00:00
parent 3fa8c1c7b6
commit e327625b64

View File

@ -108,15 +108,11 @@ KurentoManager.prototype.exitScreenShare = function () {
this.kurentoScreenshare.dispose();
this.kurentoScreenshare = null;
}
if (typeof this.kurentoVideo !== 'undefined' && this.kurentoVideo) {
this.exitVideo();
}
};
KurentoManager.prototype.exitVideo = function () {
try {
if (typeof this.kurentoVideo !== 'undefined' && this.kurentoVideo) {
if(this.kurentoVideo.webRtcPeer) {
this.kurentoVideo.webRtcPeer.peerConnection.oniceconnectionstatechange = null;
}
@ -137,6 +133,13 @@ KurentoManager.prototype.exitVideo = function () {
this.kurentoVideo.dispose();
this.kurentoVideo = null;
}
}
catch (err) {
if (this.kurentoVideo) {
this.kurentoVideo.dispose();
this.kurentoVideo = null;
}
}
};
KurentoManager.prototype.exitAudio = function () {