如何允许 Chrome 在本地主机上访问我的相机? [英] How to allow Chrome to access my camera on localhost?

查看:43
本文介绍了如何允许 Chrome 在本地主机上访问我的相机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从这个链接克隆了一个关于在网络浏览器上进行实时图像处理的项目:然后我不能让我的浏览器访问我的相机.我收到了这个 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, 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 文件托管在网络服务器上.一个快速的技巧是在 HTML 页面所在的文件夹中使用 python: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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆