javascript - 获取 iFrame 的显示媒体

标签 javascript html jitsi jitsi-meet

我正在使用 iframe 打开 Jitsi session 室。该 session 室具有视频/音频/屏幕共享功能。现在我的问题是,由于它是一个 iframe,我必须允许显示媒体的权限。我这样做了,正如您在下面看到的那样,但我也收到了这些错误:

errorMsg: "Failed to execute 'getDisplayMedia' on 'MediaDevices': Access to the feature \"display-capture\" is disallowed by permission policy."
errorName: "SecurityError"
errorStack: "Error: Failed to execute 'getDisplayMedia' on 'MediaDevices': Access to the feature \"display-capture\" is disallowed by permission policy.\n

为什么会发生这种情况?如何克服它,以便我的浏览器 (Chrome/Firefox) 可以显示摄像头、麦克风和屏幕共享选项?

<iframe id="PDF_iframe" src="https://myHost121.de/downloads/index.html" style="
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    height: 60%;
    width: 60%;
    z-index: 2;
    display: Block;
    allow: camera; microphone; display-capture; autoplay; clipboard-write;
  ">
    </iframe>

最佳答案

允许在CSS样式中。它应该是一个属性

<iframe id="PDF_iframe" src="https://myHost121.de/downloads/index.html" style="position: fixed; top: 0; bottom: 0; left: 0; right: 0; margin: auto; height: 60%; width: 60%; z-index: 2; display: block;" allow="camera; microphone; display-capture; autoplay; clipboard-write;"></iframe>

关于javascript - 获取 iFrame 的显示媒体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70712776/

相关文章:

javascript - Node : How to take dimension of pdf pages with nodejs?

javascript - 如何在 <span class ="xy"> 之后包装所有 HTML 代码,直到下一次出现 </p>?

html - 我如何从 Google Visualization 中将条形图居中?

python - 有没有库函数可以用html代码替换字符? [Python]

css - 推特 Bootstrap : Select element in Nav bar

webrtc - 对于一对多直播,jitsi videobridge 和 janus gateway 哪个更便宜?

javascript - 检查单选按钮中的值

javascript - jquery 从 url 获取参数也会在控制台日志中留下 url

java - 如何修改ice4j LocalCandidate