Error while shooting with MeteorCamera.getPicture () when testing on laptop
I am working on adding photography ability to my application using Meteor mdg: camera plugin. I don't have PhoneGap settings yet, so I'm testing my laptop. I thought that somewhere I read somewhere that the Meteor implementation would fall away and use a simple file dialog when the camera is not available, but when I try to run the following code on my laptop:
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});
}
});
I am getting the error:
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"β¦}
I would really like users to be able to upload photos using the same button when using a laptop. For what it's worth, I do have a built-in camera and am developing on a 15-inch MacBook Pro.
source to share
In the browser, the client mdg:camera
comes back with navigator.getUserMedia
to try to get the video stream from the webcam, it doesn't allow the user to upload the photo.
https://github.com/meteor/mobile-packages/blob/master/packages/mdg:camera/photo-browser.js#L41
Unfortunately, as we speak getUserMedia
, there is a lack of support for Safari, which is probably the browser you use on your MacBook.
http://caniuse.com/#feat=stream
Try your app on Google Chrome or Firefox.
source to share