我正在使用 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/