简体   繁体   English

如何检测用户是否在 Chrome 扩展程序中共享屏幕?

[英]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 .我希望我的 chrome 扩展程序能做一些事情,除非用户通过getDisplayMedia共享他/她的屏幕或 window。 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 ?是否可以在chrome 扩展程序中查询特定选项卡或其他内容以检测通过基于网络的应用程序(如 Team viewer、Zoom、Google Meet、Facebook Messenger、Viber 等)执行的任何类型的屏幕共享?

Netflix already does this without using any sort of chrome extension (albeit only when sharing entire screen, not a window or tab). Netflix 已经在不使用任何类型的 chrome 扩展的情况下做到了这一点(尽管仅在共享整个屏幕时,而不是 window 或标签)。 The Netflix video goes black. Netflix 视频变黑。 So there must be some way with privileged access through a chrome extension?那么一定有某种方式可以通过 chrome 扩展程序进行特权访问吗?

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.有一些扩展会覆盖本机 api。您可以插入一个脚本来覆盖 getDisplayMedia function 以“通知”您的扩展激活,然后调用原始脚本。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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