简体   繁体   English

getUserMedia.js未检测到相机

[英]getUserMedia.js not detecting camera

I am currently hoping to use a getUserMedia (HTML5) tool to create webcam accessible site. 我目前希望使用getUserMedia(HTML5)工具来创建可访问网络摄像头的网站。 The tool found here . 该工具在这里找到。 It's supposed to use HTML5 to get webcam access, but has a flash fallback for non supported browsers. 它应该使用HTML5来获取网络摄像头访问权限,但对于不支持的浏览器具有Flash备用功能。 But when I download it and open the demo locally on my computer I get the error: "JavaScript Alert: No camera available." 但是,当我下载它并在计算机上本地打开演示时,出现错误:“ JavaScript警告:没有可用的摄像头。” But when I use the web demo found here . 但是当我使用这里的网络演示时。 Anyone have an ideas on where I may have gone wrong? 有人对我可能出了问题的地方有想法吗? Thanks. 谢谢。

The web demo worked fine for me and I'm using Chrome: 该网络演示对我来说效果很好,我正在使用Chrome:

  • Do you have a camera on your device? 您的设备上有相机吗? That's a simple reason why it wouldn't work. 这是为什么它不起作用的简单原因。
  • Which browser are you using? 您正在使用哪个浏览器? Is the tool compatible with the your browser? 该工具与您的浏览器兼容吗? see below for explanation. 请参阅下面的说明。
  • Are you running this on from file? 您正在从文件上运行它吗? Perhaps (I'm really only guessing) navigator variable doesn't work when loading from file 从文件加载时,也许(我只是在猜测) navigator变量不起作用

It probably got this error after it tried accessing your camera when calling the navigator.getUserMedia() function, which is what that tool uses. 在调用navigator.getUserMedia()函数(该工具使用该函数navigator.getUserMedia()时尝试访问您的相机后,可能会出现此错误。
I made that function compatable by defining the function to be: 通过将函数定义为使该函数兼容:

navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

This is only compatible on Chrome and Firefox (and one other browser which I forgot) but, according to what I've seen recently, not on IE. 这仅在Chrome和Firefox(以及我忘记的其他浏览器)上兼容,但根据我最近看到的信息,在IE上不兼容。

Good Luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM