I'm a kind of newbie webOS Developer, and I'm currently developing an App where I need to take a picture of a certain user.
I've been looking for many resources and sites on the internet but I can't find a solution for my problem.
I follow the instructions that list here:
How to take a picture using command line on webOS on HP touchpad?
I want to let clear that I don't want to take the photo from the command line.
I tried the following:
A. Include in my depends.js
"$enyo/../lib/mediacapture/"
B. In my scene
enyo.kind({
name: "MyComponent",
kind: "Pane",
components: [
{
kind: "enyo.MediaCapture",
name: "mediaCapture",
onInitialized: "onImageCaptureInitialized",
onError: "onImageCaptureError",
onImageCaptureComplete: "onImageCaptureComplete"
}
],
...
..
.
});
C. Inside the onCreate function
create: function () {
this.inherited(arguments);
this.$.mediaCapture.initialize(this.$.ViewPort);
},
D. Inside the onInitialized Event
onImageCaptureInitialized: function () {
var keyString;
for(var i = 0; i < this.pb.deviceKeys.length; i++) {
if(this.pb.deviceKeys[i].description.indexOf("Camera/Camcorder") >= 0) {
keyString = this.pb.deviceKeys[i].deviceUri;
break;
}
}
if(keyString) {
var formatObj = {imageCaptureFormat: this.pb[keyString].supportedImageFormats[0]};
this.$.mediaCapture.load(keyString, formatObj);
}
},
D. Inside the onclick Event of a certain button
takePhotoClickEvent: function (inSender) {
this.$.mediaCapture.startImageCapture("/media/internal/CanalCocina/recipe_photo.jpg",
{
"bitrate":128000,
"samplerate":8000,
"width":480,
"height":320,
"mimetype":"image/jpeg",
"codecs":"jpeg"}
);
},
When I run the app on the HP TouchPad I get the next log in my console:
info: MediaCapture::ServiceProxy ===== MediaCapture::_initializeMediaServerInstanceSuccess() ...palm://com.palm.mediad.MediaCaptureV3_1814440/, /usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:83 [20111017-16:52:32.906482] info: MediaCapture::ServiceProxy @@@@@@----------- FIRST PROPERTY GRAB -----------@@@@@@, /usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:106 [20111017-16:52:32.913991] info: MediaCapture::ServiceProxy inResponse: {"propertyValues":[{"name":"ready","value":false},{"name":"supportedAudioFormats","value":[{"bitrate":128000,"samplerate":8000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":256000,"samplerate":16000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":705600,"samplerate":44100,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":128000,"samplerate":8000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":256000,"samplerate":16000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":705600,"samplerate":44100,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":128000,"samplerate":8000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":256000,"samplerate":16000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":705600,"sampl
However when the app tries to load the mediaCapture Object I get:
Uncaught TypeError: Cannot read property 'deviceKeys' of undefined, source/CCRecipesStep1View.js:186
I know and I understand that this error is because the App try to access a property that doesn't exist. In this case the particular line is:
onImageCaptureInitialized: function () {
var keyString;
for(var i = 0; i < this.pb.deviceKeys.length; i++) <<------------ Here
...
..
.
}
The file MediaCapture.js and the instructions I follow talk about the "Property Bag" , I understand that this is where you declare the properties, however I don't know how to get the device keys that I need to load the MediaCaptureObject.
When the button is pressed I get:
MediaCapture::ServiceProxy #######----------- CHANGE PROPERTIES EVENT -----------######vuData , /usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140 [20111017-17:07:35.401836] info: MediaCapture::ServiceProxy
#----------- CHANGE PROPERTIES EVENT -----------######vuData ,/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140 [20111017-17:07:35.653586] info: MediaCapture::ServiceProxy
#----------- CHANGE PROPERTIES EVENT -----------######vuData ,/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140 [20111017-17:07:35.885940] info: MediaCapture::ServiceProxy
#----------- CHANGE PROPERTIES EVENT -----------######vuData ,/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140
And start an infinite loop :S
I hope you cal help me. This App is very important.
Thank you.