RTCMultiConnection 上的 WebRTC PermissionDeniedError getUserMedia

标签 webrtc getusermedia

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. 请尝试AppRTC demo这是使用 RTCMultiConnection v2.2.2 构建的

您能否尝试这个演示来查看您系统上可用的音频/视频设备的数量:https://www.webrtc-experiment.com/demos/MediaStreamTrack.getSources.html

如果 Chrome 上的网络摄像头被拒绝,您将在此处看到 isWebcamAlreadyCaptured == false:https://stackoverflow.com/a/30047627/552182

另外:

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

关于RTCMultiConnection 上的 WebRTC PermissionDeniedError getUserMedia,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34305323/

相关文章:

javascript - 使用 JavaScript 在浏览器中控制 USB PTZ 摄像头

javascript - RTCPeerConnection 在 Firefox 和 Safari 中不是构造函数

google-chrome - 无法在 Google Chrome 中选择正确的网络摄像头

android - GetUserMedia 访问在 Cordova Android 应用、WebRTC 和 Kurento 集成上被拒绝

ios - 如何解决 XCode 中的链接器警告 "ignoring linker optimzation hint at"?

c# - WebRTC 媒体服务器

html - peerConnection.addIceCandidate 给出错误 : invalid string

javascript - JS浏览器: check if error generated by getUserMedia() is a DOMException error object

javascript - 如何使用 XMLHttpRequest 和 asp.net MVC 将大型 blob 发布到服务器?

node.js - 从 MediaRecorder 发送 block 到服务器并在浏览器中播放