0
我開始使用與Meteor的PhoneGap集成,並且無法讓插件工作。有人可能會提供以下步驟,我將如何使用相機插件。目前我只在模擬器上運行它。代碼如下。預先感謝。如何使用流星PhoneGap插件
我加入了攝像頭插件是這樣的: 流星添加科爾多瓦:[email protected]
然後使用它,我有以下代碼:
if (Meteor.isClient) {
Template.hello.events({
'click button': function() {
// increment the counter when button is clicked
navigator.camera.getPicture(
function(data){ Session.set("picture", res); },
function(err){ console.log(err); },
{
quality: 50,
destinationType: Camera.DestinationType.DATA_URL
}
);
}
});
}
if (Meteor.isServer) {
Meteor.startup(function() {
// code to run on server at startup
});
}
當我點擊按鈕我得到這個錯誤:
I20141006-21:58:33.174(-7)? (ios) Camera.getPicture: source type 1 not available.
I20141006-21:58:33.222(-7)? (ios) no camera available
我不相信iPhone模擬器允許GPS或照片。 Chrome會讓你做到這一點,我發現。 – CodeChimp 2014-10-07 19:59:27
@CodeChimp此代碼在Android模擬器上啓動相機,但不適用於瀏覽器。有什麼想法嗎? – 2014-10-15 03:34:53
幾周前看到我的問題:http://stackoverflow.com/questions/26182267/error-while-taking-pictures-using-meteorcamera-getpicture-while-testing-on-a-l – CodeChimp 2014-10-15 10:31:24