カメラ機能を使用したブラックベリーアプリがあります。
コードベースは、PhoneGap2.3.0内で提供される「サンプルアプリ」に由来します
インデックスHTMLに行が追加されました
<input type="button" value="Take Picture" onclick="app.takePhoto();" />
index.jsには次の関数が追加されています。
takePhoto: function(){
navigator.camera.getPicture(this.cameraSuccess,
this.cameraError,
{ quality: 50,
destinationType: Camera.DestinationType.DATA_URL
} );
},
cameraSuccess: function(imageData){
console.log(imageData);
var image = document.getElementById('myImage');
image.src = "data:image/jpeg;base64," + imageData;
},
cameraError: function(){
alert("error!");
}
Ripple Simulatorを実行すると、chromeのエラーコンソールに次のように表示されます。
Received Event: deviceready cordova-2.3.0.js:8165
Received Event: deviceready ripple.js:39
blob:http%3A//localhost/1b218c8e-6902-4780-a652-8f7f4d52fe28 cordova-2.3.0.js:8165
blob:http%3A//localhost/1b218c8e-6902-4780-a652-8f7f4d52fe28 ripple.js:39
GET data:image/jpeg;base64,blob:http%3A//localhost/1b218c8e-6902-4780-a652-8f7f4d52fe28
シミュレーターを実行すると、カメラデータとして画像を追加した後、エラーポップアップが表示されます。エラーログには次のように表示されます。
1:01:16.054: cordovaExample [2013-01-14 18:55:03.858]: Error in error callback: Camera1387674010 = ReferenceError: Can't find variable: imageData
デバイスで実行すると、エラー出力の読み取り方法が実際にはわかりません。
私が示したものに基づいて、私のPhone Gapアプリケーションがブラックベリーデバイスで写真を撮っていないのはなぜですか?