From 119b79fd8416d566ae931e03b2f369358c86187d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 18 Sep 2020 14:28:54 +0200 Subject: [PATCH] fix(SmallVideo) screen-sharing indicator The stream is attached before the video type change event is fired, so comparing them is too late. Unconditionally update the screen-sharing indicator, and perform the check for a change right there, to avoid re-renders. --- modules/UI/videolayout/RemoteVideo.js | 2 -- modules/UI/videolayout/SmallVideo.js | 4 ++++ modules/UI/videolayout/VideoLayout.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index a3ed26d6f..f01278293 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -373,7 +373,6 @@ export default class RemoteVideo extends SmallVideo { if (stream === this.videoStream) { this.videoStream = null; - this.videoType = undefined; } this.updateView(); @@ -484,7 +483,6 @@ export default class RemoteVideo extends SmallVideo { if (isVideo) { this.videoStream = stream; - this.videoType = stream.videoType; } else { this.audioStream = stream; } diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index 1319fc245..8a4c9ca22 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -243,6 +243,10 @@ export default class SmallVideo { * or hidden */ setScreenSharing(isScreenSharing) { + if (isScreenSharing === this.isScreenSharing) { + return; + } + this.isScreenSharing = isScreenSharing; this.updateView(); this.updateStatusBar(); diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index 386baccce..a0072ac47 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -489,7 +489,7 @@ const VideoLayout = { onVideoTypeChanged(id, newVideoType) { const remoteVideo = remoteVideos[id]; - if (!remoteVideo || remoteVideo.videoType === newVideoType) { + if (!remoteVideo) { return; }