RTCMultiConnection 上的 WebRTC PermissionDeniedError getUserMedia

WebRTC PermissionDeniedError getUserMedia on RTCMultiConnection

RTCMultiConnection 上突然出现 PermissionDeniedError 和 getUserMedia 错误,而一切都运行良好。 而且不仅在 Chrome.

考虑到 API 是实验性的,并且限制和浏览器的兼容性不断变化,并且知道这个问题已经被再次提出,没有看到任何可用的回复,在这种情况下,我冒着风险问。

我认为错误与

无关
getUserMedia() no longer works on insecure origins. 

以上问题出现在 Opera 34.0 和 Chrome 47,而 Firefox 40 运行良好。

这不是应用程序的错误或相机兼容性问题,因为我也在 https://jsfiddle.net/zar6fg60/ 中进行了测试,台式机相机和笔记本电脑都出现了以下相同的错误。

控制台日志错误

name PermissionDeniedErrorconnection.onMediaError @ RTCMultiConnection.js:5592mediaConfig.onerror @ RTCMultiConnection.js:594(anonymous function) @ RTCMultiConnection.js:3931getUserMedia @ RTCMultiConnection.js:3930_captureUserMedia @ RTCMultiConnection.js:678captureUserMedia @ RTCMultiConnection.js:503(anonymous function) @ RTCMultiConnection.js:118initRTCMultiSession @ RTCMultiConnection.js:228connection.open @ RTCMultiConnection.js:108_.onclick @ inter_stream.js:240
RTCMultiConnection.js:5593 constraintName {
    "audio": {
        "mandatory": {},
        "optional": [
            {
                "chromeRenderToAssociatedSink": true
            }
        ]
    },
    "video": true
}connection.onMediaError @ RTCMultiConnection.js:5593mediaConfig.onerror @ RTCMultiConnection.js:594(anonymous function) @ RTCMultiConnection.js:3931getUserMedia @ RTCMultiConnection.js:3930_captureUserMedia @ RTCMultiConnection.js:678captureUserMedia @ RTCMultiConnection.js:503(anonymous function) @ RTCMultiConnection.js:118initRTCMultiSession @ RTCMultiConnection.js:228connection.open @ RTCMultiConnection.js:108_.onclick @ inter_stream.js:240
RTCMultiConnection.js:5594 message Either: 
 Media resolutions are not permitted.
 Another application is using same media device.
 Media device is not attached or drivers not installed.
 You denied access once and it is still denied.
 Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).connection.onMediaError @ RTCMultiConnection.js:5594mediaConfig.onerror @ RTCMultiConnection.js:594(anonymous function) @ RTCMultiConnection.js:3931getUserMedia @ RTCMultiConnection.js:3930_captureUserMedia @ RTCMultiConnection.js:678captureUserMedia @ RTCMultiConnection.js:503(anonymous function) @ RTCMultiConnection.js:118initRTCMultiSession @ RTCMultiConnection.js:228connection.open @ RTCMultiConnection.js:108_.onclick @ inter_stream.js:240
RTCMultiConnection.js:5595 original session Object {audio: true, video: true}

Solution Updated to secure http and everything is working well right now, thanks to Muaz Khan. Chrome has a notice about secure origins and there is a w3c new context on media access at non-secure urls.

  1. 请确保您使用的是 RTCMultiConnection v2.2.2。
  2. 确保您的域允许网络摄像头(视频):chrome://settings/contentExceptions#media-stream-camera
  3. 您似乎在使用 HTTP。这是有道理的。
  4. 你似乎在使用 {audio:true,vide:true} 所以这里没有 "screen:true" 例外!
  5. 请尝试使用 RTCMultiConnection v2.2.2 构建的AppRTC demo

能否请您尝试此演示以查看系统上可用的 audio/video 设备数量:https://www.webrtc-experiment.com/demos/MediaStreamTrack.getSources.html

如果网络摄像头在 Chrome 上被拒绝,您将在此处看到 isWebcamAlreadyCaptured == false

另外:

  1. 请分享您的浏览器版本:https://www.webrtc-experiment.com/DetectRTC/
  2. 请确保另一个应用程序 (Firefox/etc.) 不是 使用相同的相机。