'Detecting if another tab is sharing screen on client's browser, and stopping them from sharing

Generally, with a webcam, if a browser tab, or a desktop app is using the webcam, other sources cannot use that webcam until the first app stops.

In a similar way is it possible to detect if there is a screen already being shared in another tab while my web app also tries to share a screen?

If so, is there a way to terminate that other stream before starting mine?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source