Meteor:mdg:相机包失败

时间:2015-12-18 10:25:51

标签: google-chrome firefox meteor camera

我做:

MeteorCamera.getPicture({
            quality : 85
        }, function(err, data) {
            if (err) {
                console.error(err);
            } else {
                Session.set("photoUri", data);
            }
        });

如果我在本地运行Meteor并访问localhost:3000,一切都按预期工作。

但是,如果我在meteor.com部署中对此进行测试......

在Chrome中,我看到一个对话框:

Camera Permissions Denied
You have denied this app permission to use your camera. If you would like to allow permissions, follow the directions for your browser below.

Google Chrome
Go to Settings > "Show advanced settings..." > "Content settings..." >    Media heading > "Manage exceptions...", then find this website in the list and allow video capture.

Mozilla Firefox
Reload the page and try again.

Opera
Go to Preferences > Websites > Media heading > "Manage exceptions...", then find this website in the list and allow video capture.

我确实找到了"例外"有问题的设置(在不同于描述的地方),但似乎无法编辑此列表......

所以,我尝试在Firefox中看到:

There was an error accessing the camera.

Chrome和Firefox都没有将任何错误传递给回调函数。

此行为在桌面和Android设备上的浏览器中都是相同的。

1 个答案:

答案 0 :(得分:1)

从chrome中的控制台:

getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details

在localhost之外,您必须运行安全站点(https)才能正常工作。

试试这个证明以上内容:
http://cheese-test.meteor.com/
VS
https://cheese-test.meteor.com/