不支持WebRTC getusermedia deviceID约束
我正在尝试通过使用webrtc api navigator.mediadevices.getusermedia
来从用户那里获取设备ID。但是该函数会引发超构成
,其中具有约束
属性 sede deviced 。这意味着
DeviceID
出现了问题。
但是,我认为浏览器无法获得设备ID的任何理由。实际上,我以前从未经历过这个问题。
您是否知道原因是什么?是因为相机还是浏览器?
I am trying to get device Id from user by using WebRTC API navigator.mediaDevices.getUserMedia
. But the function throws an OverconstrainedError
which has constraint
property inside says deviceId
. This means something was wrong with the deviceId
.
However, I don't see any reason for browser to can't get device ID. Actually I haven't experienced this issue before.
Do you have any idea what would be the reason? Would it be because of the camera or is it all about the browser?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定您要传递的内容是与口香糖的矛盾,但是如果您在github上查看此代码( https://webrtc.github.io/samples/src/src/src/src/content/devices/input-xutput/ ),它提供了一个很好的例子源(或逐步浏览调试器中的代码)设置了哪些约束以及如何获得DeviceID-请注意,这不是我的代码,而是WEBRTC样本的一部分。
Not exactly sure what you are passing as contraints to the gUM but if you look at this code on github ( https://webrtc.github.io/samples/src/content/devices/input-output/ ), it provides a good example of toggling various media inputs and you can see in the source (or step through the code in the debugger) what the constraints are set to and how they get the deviceId - note this is not my code but is part of the webRTC samples.