突然在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}
解决方案 更新以保护http,并且由于Muaz Khan,一切正常。 Chrome有关于secure origins的通知,并且非安全网址上的媒体访问权限为w3c new context。
答案 0 :(得分:2)
chrome://settings/contentExceptions#media-stream-camera
您可以尝试使用此演示查看系统上可用的音频/视频设备数量:https://www.webrtc-experiment.com/demos/MediaStreamTrack.getSources.html
如果在Chrome上拒绝了网络摄像头,您将在此处看到isWebcamAlreadyCaptured == false
:https://stackoverflow.com/a/30047627/552182
此外: