I can see why you'd want to build this feature, but unfortunately, detecting whether a user has an active screen-sharing session via any external application (like TeamViewer, Zoom, or Google Meet) isn't directly possible from a web-based application using JavaScript. This is a deliberate limitation for some security and privacy reasons:
- Browser Sandboxing: Modern web browsers are designed to run web pages in a "sandbox." This is a crucial security feature that isolates the code from your website from the user's operating system. Because of this, browsers simply don't provide APIs to peek into system-level details like what other processes are running or what they are doing.
- Privacy Concerns: Allowing any website to detect if you're running screen-sharing software would be a significant privacy risk. Imagine a malicious website being able to know when you're in a private meeting. To protect users, operating systems and browsers intentionally prevent this kind of access.
- Limited Browser Control: There is a relevant API called MediaDevices.getDisplayMedia which can start a screen-share session from your own website. However, its control is limited to the stream it creates. It has no awareness of what other applications or browser tabs are doing.