如何允许Chrome在本地主机上访问我的相机? [英] How to allow Chrome to access my camera on localhost?
问题描述
我在此链接的网络浏览器上克隆了一个关于实时图像处理的项目:
然后我无法允许我的浏览器访问我的相机。
我收到了此javascript提醒:
I cloned a project about real-time image processing on a web browser from this link: Then I could not allow my browser to access my camera. I got this javascript alert:
Uh-oh,网络摄像头没有启动。你有网络摄像头吗?你给它
权限吗?刷新以重试。
如果我访问他的网站,则不显示允许按钮。
Uh-oh, the webcam didn't start. Do you have a webcam? Did you give it permission? Refresh to try again. And the allow button is not shown as if I access his site.
推荐答案
您是否正在localhost上访问通过HTTP提供的网页?如果您从 http:// localhost / ...
访问它,Chrome将要求您授予使用相机的权限。
Are you accessing the webpage that is served over HTTP, on localhost? If you are accessing it from http://localhost/...
, Chrome will ask for your permission to use the camera.
如果您直接打开网页,即/Users/Methuz/Documents/index.html,则它将无法工作,即使您明确允许它。
If you are opening the web page directly, i.e. /Users/Methuz/Documents/index.html then it will not work, even if you explicitly allows it permission
在这种情况下,我使用的解决方法是在网络服务器上托管HTML文件。一个快速的hack是使用python,在HTML页面覆盖的文件夹: python -m SimpleHTTPServer
In this case, the workaround I use is to host the HTML file on a webserver. A quick hack is to use python, in the folder where the HTML page is lcoated: python -m SimpleHTTPServer
这篇关于如何允许Chrome在本地主机上访问我的相机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!