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
Handles track removed and removes video elements. When switching on and off desktop sharing video elements number grow under remote video span.
damencho3c61bac3c8f6
diff --git a/conference.js b/conference.jsindex 192a65a6b5..0fd7e8d31a 100644--- a/conference.js+++ b/conference.js@@ -670,7 +670,10 @@ export default {});room.on(ConferenceEvents.TRACK_REMOVED, (track) => {- // FIXME handle+ if(!track || track.isLocal())+ return;++ APP.UI.removeRemoteStream(track);});room.on(ConferenceEvents.TRACK_MUTE_CHANGED, (track) => {diff --git a/modules/UI/UI.js b/modules/UI/UI.jsindex e1b77e2f2a..c75c7b926c 100644--- a/modules/UI/UI.js+++ b/modules/UI/UI.js@@ -444,6 +444,14 @@ UI.addRemoteStream = function (track) {VideoLayout.onRemoteStreamAdded(track);};+/**+ * Removed remote stream from UI.+ * @param {JitsiTrack} track stream to remove+ */+UI.removeRemoteStream = function (track) {+ VideoLayout.onRemoteStreamRemoved(track);+};+function chatAddError(errorMessage, originalText) {return Chat.chatAddError(errorMessage, originalText);}diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.jsindex 7683c671fd..f0bb321557 100644--- a/modules/UI/videolayout/RemoteVideo.js+++ b/modules/UI/videolayout/RemoteVideo.js@@ -143,14 +143,16 @@ if (!interfaceConfig.filmStripOnly) {* @param stream the MediaStream* @param isVideo <tt>true</tt> if given <tt>stream</tt> is a video one.*/-RemoteVideo.prototype.removeRemoteStreamElement =- function (stream, isVideo, id) {+RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {if (!this.container)return false;+ var isVideo = stream.isVideoTrack();++ var elementID = SmallVideo.getStreamElementID(stream);var select = null;if (isVideo) {- select = $('#' + id);+ select = $('#' + elementID);}elseselect = $('#' + this.videoSpanId + '>audio');diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.jsindex 2ea5d87ead..e55eafec6b 100644--- a/modules/UI/videolayout/SmallVideo.js+++ b/modules/UI/videolayout/SmallVideo.js@@ -129,7 +129,7 @@ SmallVideo.createStreamElement = function (stream) {RTCUIHelper.setAutoPlay(element, true);- element.id = (isVideo ? 'remoteVideo_' : 'remoteAudio_') + stream.getId();+ element.id = SmallVideo.getStreamElementID(stream);element.onplay = function () {console.log("(TIME) Render " + (isVideo ? 'video' : 'audio') + ":\t",@@ -141,6 +141,15 @@ SmallVideo.createStreamElement = function (stream) {return element;};+/**+ * Returns the element id for a particular MediaStream.+ */+SmallVideo.getStreamElementID = function (stream) {+ let isVideo = stream.isVideoTrack();++ return (isVideo ? 'remoteVideo_' : 'remoteAudio_') + stream.getId();+};+/*** Configures hoverIn/hoverOut handlers.*/diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.jsindex 15502b3eec..b7f20e1e21 100644--- a/modules/UI/videolayout/VideoLayout.js+++ b/modules/UI/videolayout/VideoLayout.js@@ -269,6 +269,11 @@ var VideoLayout = {}},+ onRemoteStreamRemoved (stream) {+ let id = stream.getParticipantId();+ remoteVideos[id].removeRemoteStreamElement(stream);+ },+/*** Return the type of the remote video.* @param id the id for the remote video