The share screen button is now displayed only when screen sharing makes sense.

Also, fixed the button not aligned bug
This commit is contained in:
David Négrier 2021-05-21 18:26:50 +02:00
parent dd428bc1e1
commit 4c4f310b79
3 changed files with 30 additions and 3 deletions

View file

@ -178,3 +178,15 @@ export const screenSharingLocalStreamStore = derived<Readable<MediaStreamConstra
}
})();
});
/**
* A store containing whether the screen sharing button should be displayed or hidden.
*/
export const screenSharingAvailableStore = derived(peerStore, ($peerStore, set) => {
if (!navigator.getDisplayMedia && !navigator.mediaDevices.getDisplayMedia) {
set(false);
return;
}
set($peerStore.size !== 0);
});