【发布时间】:2015-12-16 06:30:47
【问题描述】:
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}
解决方案 感谢Muaz Khan,已更新以保护 http,现在一切正常。 Chrome 有一个关于 secure origins 的通知,并且有一个 w3c new context 在非安全 URL 的媒体访问。
【问题讨论】:
-
您是否使用 NAT 遍历您自己的 stun/ice/turn 服务器?如果没有,您的密钥许可可能已过期?
-
我是否必须为 WebRTC 应用程序实现自己的 STUN/TURN 服务器?我现在正在使用外部资源。
-
否,但您的这些资源的密钥/许可证可能已过期?
标签: webrtc getusermedia