Making sure the "stopped screensharing" log is not displayed on startup

This commit is contained in:
David Négrier 2021-06-04 16:08:02 +02:00
parent 01ce94585a
commit 469cac9656

View File

@ -65,6 +65,7 @@ export class MediaManager {
} }
}); });
let isScreenSharing = false;
screenSharingLocalStreamStore.subscribe((result) => { screenSharingLocalStreamStore.subscribe((result) => {
if (result.type === 'error') { if (result.type === 'error') {
console.error(result.error); console.error(result.error);
@ -75,10 +76,14 @@ export class MediaManager {
} }
if (result.stream !== null) { if (result.stream !== null) {
isScreenSharing = true;
this.addScreenSharingActiveVideo('me', DivImportance.Normal); this.addScreenSharingActiveVideo('me', DivImportance.Normal);
HtmlUtils.getElementByIdOrFail<HTMLVideoElement>('screen-sharing-me').srcObject = result.stream; HtmlUtils.getElementByIdOrFail<HTMLVideoElement>('screen-sharing-me').srcObject = result.stream;
} else { } else {
this.removeActiveScreenSharingVideo('me'); if (isScreenSharing) {
isScreenSharing = false;
this.removeActiveScreenSharingVideo('me');
}
} }
}); });