在Firefox中的本地主机上的Twilio屏幕共享?

y_a*_*arl 2 javascript firefox twilio webrtc

目前在firefox中localhost上的屏幕共享会引发以下错误: The request is not allowed by the user agent or the platform in the current context..

这是我的代码:

navigator.mediaDevices.getUserMedia({ video: { mediaSource: 'screen' } })
      .then((stream) => {
            console.log('stream', stream)
      })
      .catch((err) => {
            console.log('err', err)
      })
Run Code Online (Sandbox Code Playgroud)

Phi*_*cke 6

如果您正在使用它进行测试,请media.navigator.permission.disabled在about:config中设置为true,跳过对话框和错误.

  • 因为它仅用于测试目的 - 如果没有您的明确许可,您不希望随机网站访问您的相机. (2认同)