简体   繁体   中英

How to detect if user is screen sharing in a Chrome Extension?

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?

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)
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM