I am trying out the Meteor Cordova camera plugin and it won't work and I have no idea what I am missing.
Here is what I did:
1) Meteor create new project
2) Added the cordova camera package meteor add cordova:org.apache.c...@0.3.1
3) Programmed the default button on screen to take a picture and then append it to the body. This should use the camera built into the laptop computer but all I get when I click the button is: Uncaught TypeError: Cannot read property 'getPicture' of undefined And when I run the app in the iPhone simulator with the command meteor run ios and click the button I get a popup error: Failed because: no camera available
This is what my html and js file look like:
main.html
<head>
<title>cameraTest</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
{{> hello}}
</body>
<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
</template>
main.js
if (Meteor.isClient) {
// counter starts at 0
function onSuccess(imageData) {
var image = document.getElementById('myImage');
image.src = "data:image/jpeg;base64," + imageData;
$('body').append(image);
}
function onFail(message) {
alert('Failed because: ' + message);
}
Session.setDefault("counter", 0);
Template.hello.helpers({
counter: function () {
return Session.get("counter");
}
});
Template.hello.events({
'click button': function () {
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.DATA_URL
});
}
});
}Feel free to respond here or in the stackoverflow: http://stackoverflow.com/questions/26454473/meteor-cordova-cannot-get-camera-plugin-to-work-uncaught-typeerror-cannot-rea