gpt4 book ai didi

meteor - 在笔记本电脑上测试时使用 MeteorCamera.getPicture() 拍照时出错

转载 作者:行者123 更新时间:2023-12-02 01:44:57 25 4
gpt4 key购买 nike

我正在使用 Meteor 的 mdg:camera 插件为我的应用程序添加照片功能。目前,我没有任何 PhoneGap 设备设置,所以我正在我的笔记本电脑上进行测试。我以为我在某处读到 Meteor 实现会回退并在相机不可用时使用简单的文件对话框,但是当我尝试在笔记本电脑上运行以下代码时:

var cameraOptions = {
width: 800,
height: 600
};

MeteorCamera.getPicture(cameraOptions, function (err, data) {
if (err) {
console.log(err);
// TODO Need to handle the error
} else {
if (!this.photos) {
this.photos = [];
}

this.photos.push({ submitted_by: Meteor.userId(), submitted_on: new Date(), photo_data: data});
}
});

我得到错误:

Meteor.makeErrorType.errorClass {error: "unknownError", reason: "There was an error while accessing the camera.", details: undefined, message: "There was an error while accessing the camera. [unknownError]", errorType: "Meteor.Error"…}

我实际上希望用户在使用笔记本电脑时能够通过相同的按钮上传照片。值得一提的是,我确实有一个内置摄像头,而且我正在 15 英寸 MacBook Pro 上进行开发。

最佳答案

在浏览器客户端上,mdg:camera 退回到使用 navigator.getUserMedia 尝试从网络摄像头获取视频流,它不允许用户上传照片。

https://github.com/meteor/mobile-packages/blob/master/packages/mdg:camera/photo-browser.js#L41

不幸的是,我们正在谈论 getUserMedia 缺乏对 Safari 的支持,这可能是您在 MacBook 上使用的浏览器。

http://caniuse.com/#feat=stream

改为在 Google Chrome 或 Firefox 上尝试您的应用程序。

关于meteor - 在笔记本电脑上测试时使用 MeteorCamera.getPicture() 拍照时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26182267/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com