How to make an app/website visible to the user but hidden during screen sharing or video calls?

I want to implement a feature where my app or website is fully visible and interactive for the user but remains hidden or blocked when the user is screen sharing or in a video call. For example:

Similar to how Netflix blocks its video content during screen sharing, but the user can still watch it.

The app/website should detect screen sharing or recording attempts and either block the content or show a placeholder (e.g., blank screen) to others.

Are there any techniques, libraries, or best practices to achieve this? Any guidance or resources would be greatly appreciated!