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.
This commit is contained in:
Saúl Ibarra Corretgé 2020-09-18 14:28:54 +02:00 committed by Saúl Ibarra Corretgé
parent 188771751d
commit 119b79fd84
3 changed files with 5 additions and 3 deletions

View File

@ -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;
}

View File

@ -243,6 +243,10 @@ export default class SmallVideo {
* or hidden
*/
setScreenSharing(isScreenSharing) {
if (isScreenSharing === this.isScreenSharing) {
return;
}
this.isScreenSharing = isScreenSharing;
this.updateView();
this.updateStatusBar();

View File

@ -489,7 +489,7 @@ const VideoLayout = {
onVideoTypeChanged(id, newVideoType) {
const remoteVideo = remoteVideos[id];
if (!remoteVideo || remoteVideo.videoType === newVideoType) {
if (!remoteVideo) {
return;
}