I just notice that video streaming websites, such as Max and Disney Plus, can blackout their video when I activate screenshot application or when I want to share screen in Zoom. What technique is used to implement this effect? How can web pages inside a browser detect screenshot application is activated, isn't it breaking the browser sandbox? And, can this be used to prevent image/text screenshot?
What technique is used to implement this effect?
DRM.
How can web pages inside a browser detect screenshot application is activated, isn't it breaking the browser sandbox?
Neither web pages, nor the browser, detect when a screenshot or recording is happening. The browser isn't actually doing the rendering of the video. The video is encrypted, and its rendering is done further down the pipe at a lower layer. Different techniques can be used, some of which where the video isn't even decrypted until it hits the display device.
And, can this be used to prevent image/text screenshot?
Not directly. You'd have to render that content into video, and encrypt that video. This is expensive, a real hassle, and doesn't provide as much protection as you might think. That's why it's only done for protecting expensive high resolution commercial video content.