1

I would like my chrome extension to do something unless a user is screen-sharing his/her screen or window via getDisplayMedia. Is it possible to query specific tabs or something to detect any kind of screen sharing performed via web-based applications like Team viewer, Zoom, Google Meet, Facebook Messenger, Viber, etc. in a chrome extension?

Netflix already does this without using any sort of chrome extension (albeit only when sharing entire screen, not a window or tab). The Netflix video goes black. So there must be some way with privileged access through a chrome extension?

azizj
  • 3,428
  • 2
  • 25
  • 33
  • 1
    No, it's [not possible](https://stackoverflow.com/questions/74315777/javascript-prevent-screenshot-of-webpages-regions). The mechanism Netflix uses is called DRM. It is deeply baked into the browser and to some degree the Operating System. And it is only for media playback. But never exposed as a generic JavaScript API. If you encrypt your media with that high level of DRM, which is not trivial, you can get blanking for playback of these. – cachius Dec 07 '22 at 14:45

1 Answers1

0

There is some extensions that override native api. You could insert a script that overide getDisplayMedia function to 'notify' your extension of activation and then call the original one.

var saveGetDisplayMedia = navigator.mediaDevices.getDisplayMedia;
navigator.mediaDevices.getDisplayMedia = function ([arg]) {
 notifyExtension(arg)
 saveGetDisplayMedia.call(navifator.mediaDevice, ..arg)
}

Pierre Noyelle
  • 478
  • 3
  • 8