Chrome中的网络摄像头js错误:无法访问网络摄像头 [英] Webcam js Error in Chrome: Could not access webcam

查看:4332
本文介绍了Chrome中的网络摄像头js错误:无法访问网络摄像头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目中正在使用Webcam JS.

I am using Webcam JS in one of my projects.

https://github.com/jhuckaby/webcamjs

版本:1.0.0 可用的最新版本:1.0.5

version I was using: 1.0.0 Latest version available: 1.0.5

在Chrome和Firefox中都可以正常工作.但是最近网络摄像头错误开始仅在CHROME中显示. Firefox仍然可以正常工作.

It was working fine in both Chrome and Firefox. But lately webcam error started showing only in CHROME. Firefox still works fine.

我在1.0.0版中收到的错误:Webcam.JS Error: cannot access webcam.

Error that I received in 1.0.0: Webcam.JS Error: cannot access webcam.

我升级了版本,现在我在chrome中遇到的错误是

I upgraded the version and now the error I'm getting in chrome is

Webcam.js Error: Could not access webcam.
Permission Error: Only secure origins are allowed

https://goo.gl/Y0ZkNV

我的网站来源安全.

谁能告诉我为什么我要面对这样的错误?

Can anyone tell me why I'm facing errors like that?

我相信复制粘贴webcam.js代码没有意义.

I believe there's no point in copy pasting webcam.js code.

这是我使用的代码:

Webcam.set({
      width: 320,
     height: 240,
     dest_width: 320,
     dest_height: 240,
     image_format: 'jpeg',
     jpeg_quality: 90,
     force_flash: false
    });
    Webcam.attach( '#my_camera' );

推荐答案

Chrome 47要求该网站必须为HTTPS,才能使用户媒体/网络摄像头正常工作!这是我看不到的全新要求...

Chrome 47 requires that the site be HTTPS in order for user media / webcam to work! This is a brand new requirement that I didn't see coming...

有关该主题的Chromium文档: https://www.chromium.org/home/chromium-security/prefer-secure-origins-for-强大的新功能

Chromium Docs on the topic: https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features

这意味着我必须购买SSL证书.只要您在127.0.0.1或HTTPS上使用该库,该库就可以在Chrome 47中正常运行.

This means I'll have to buy a SSL cert. The library should work fine in Chrome 47, as long as you are using it on 127.0.0.1, or over HTTPS.

问题讨论

解决方案

这篇关于Chrome中的网络摄像头js错误:无法访问网络摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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