Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Fixes issues when participant leaves caused by removing src dependancies. Stops the tracks when stream is removed.
hristoterezov03f828ba9ad9
diff --git a/app.js b/app.jsindex e6986591f7..c9ff1b40ae 100644--- a/app.js+++ b/app.js@@ -1422,10 +1422,10 @@ function disposeConference(onUnload) {// FIXME: probably removing streams is not required and close() should// be enoughif (connection.jingle.localAudio) {- handler.peerconnection.removeStream(connection.jingle.localAudio);+ handler.peerconnection.removeStream(connection.jingle.localAudio, onUnload);}if (connection.jingle.localVideo) {- handler.peerconnection.removeStream(connection.jingle.localVideo);+ handler.peerconnection.removeStream(connection.jingle.localVideo, onUnload);}handler.peerconnection.close();}diff --git a/libs/strophe/strophe.jingle.adapter.js b/libs/strophe/strophe.jingle.adapter.jsindex 6496753722..44c9ae2cc5 100644--- a/libs/strophe/strophe.jingle.adapter.js+++ b/libs/strophe/strophe.jingle.adapter.js@@ -152,8 +152,16 @@ TraceablePeerConnection.prototype.addStream = function (stream) {};-TraceablePeerConnection.prototype.removeStream = function (stream) {+TraceablePeerConnection.prototype.removeStream = function (stream, stopStreams) {this.trace('removeStream', stream.id);+ if(stopStreams) {+ stream.getAudioTracks().forEach(function (track) {+ track.stop();+ });+ stream.getVideoTracks().forEach(function (track) {+ track.stop();+ });+ }this.peerconnection.removeStream(stream);};diff --git a/libs/strophe/strophe.jingle.sessionbase.js b/libs/strophe/strophe.jingle.sessionbase.jsindex 6d58aa8c6d..3f75efa589 100644--- a/libs/strophe/strophe.jingle.sessionbase.js+++ b/libs/strophe/strophe.jingle.sessionbase.js@@ -82,7 +82,7 @@ SessionBase.prototype.switchStreams = function (new_stream, oldStream, success_cif(self.peerconnection.localDescription) {oldSdp = new SDP(self.peerconnection.localDescription.sdp);}- self.peerconnection.removeStream(oldStream);+ self.peerconnection.removeStream(oldStream, true);self.peerconnection.addStream(new_stream);}diff --git a/videolayout.js b/videolayout.jsindex d9dcff44e2..6b5e890d9f 100644--- a/videolayout.js+++ b/videolayout.js@@ -122,7 +122,17 @@ var VideoLayout = (function (my) {var container = pick.parentNode;var jid = null;if(container)- jid = VideoLayout.getPeerContainerResourceJid(container);+ {+ if(container.id == "localVideoWrapper")+ {+ jid = Strophe.getResourceFromJid(connection.emuc.myroomjid);+ }+ else+ {+ jid = VideoLayout.getPeerContainerResourceJid(container);+ }+ }+VideoLayout.updateLargeVideo(RTC.getVideoSrc(pick), pick.volume, jid);} else {console.warn("Failed to elect large video");@@ -153,7 +163,13 @@ var VideoLayout = (function (my) {largeVideoState.newSrc = newSrc;largeVideoState.isVisible = $('#largeVideo').is(':visible');largeVideoState.isDesktop = isVideoSrcDesktop(jid);- largeVideoState.oldJid = largeVideoState.userJid;+ if(jid2Ssrc[largeVideoState.userJid]) {+ largeVideoState.oldJid = largeVideoState.userJid;+ }+ else+ {+ largeVideoState.oldJid = null;+ }largeVideoState.userJid = jid;// Screen stream is already rotated@@ -952,7 +968,6 @@ var VideoLayout = (function (my) {videoSpan = document.getElementById(videoContainerId);if (!videoSpan) {- console.error("No video element for jid", resourceJid);return;}