本文介绍了displaySurface约束不限制用户共享屏幕选择选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

添加displaySurface不会在共享自己的屏幕之前引起用户的选项限制.我试图将这些选项限制为仅允许用户选择浏览器选项卡以外的任何内容.

Adding displaySurface does not provoke option restriction for the user before sharing his own screen.I am trying to limit those options to only let the user select anything except browser tabs.

我尝试将displaySurface显式设置为显示器",并且仍然显示所有选项.

I tried setting displaySurface explicitly to 'monitor' and still all options being showed up.

async startCaptureMD() {
  let captureStream = null;
  var screen_constraints = {
     video: {
        cursor: "always",
        displaySurface: "monitor"
     }
  };
  try{
     captureStream = await 
     navigator.mediaDevices.getDisplayMedia(screen_constraints);
  }catch(err){
    console.log(err.message, err.code);
  }
  return captureStream;
},

预期结果是显示您的整个屏幕"或应用程序窗口",而不是"Chrome选项卡".

The expected result is to show 'Your Entire Screen' or 'Application Window' and not 'Chrome Tab'.

推荐答案

您不能. MDN 文档解释说它适用于安全性:

You can't. The MDN docs explain that it is for security:

规范说:

因此,浏览器在做正确的事情.看来displaySurface仅是一个

I also was confused, so I fixed the MDN docs.

这篇关于displaySurface约束不限制用户共享屏幕选择选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 09:03