Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to take a picture with MediaCapture in Enyo (webOS)?
    primarykey
    data
    text
    <p>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.</p> <p>I've been looking for many resources and sites on the internet but I can't find a solution for my problem.</p> <p>I follow the instructions that list here: </p> <p><a href="https://stackoverflow.com/questions/7509675/how-to-take-a-picture-using-command-line-on-webos-on-hp-touchpad">How to take a picture using command line on webOS on HP touchpad?</a></p> <p>I want to let clear that I don't want to take the photo from the command line.</p> <p>I tried the following:</p> <p><strong>A. Include in my depends.js</strong></p> <pre><code>"$enyo/../lib/mediacapture/" </code></pre> <p><strong>B. In my scene</strong></p> <pre><code>enyo.kind({ name: "MyComponent", kind: "Pane", components: [ { kind: "enyo.MediaCapture", name: "mediaCapture", onInitialized: "onImageCaptureInitialized", onError: "onImageCaptureError", onImageCaptureComplete: "onImageCaptureComplete" } ], ... .. . }); </code></pre> <p><strong>C. Inside the onCreate function</strong></p> <pre><code>create: function () { this.inherited(arguments); this.$.mediaCapture.initialize(this.$.ViewPort); }, </code></pre> <p><strong>D. Inside the onInitialized Event</strong></p> <pre><code>onImageCaptureInitialized: function () { var keyString; for(var i = 0; i &lt; this.pb.deviceKeys.length; i++) { if(this.pb.deviceKeys[i].description.indexOf("Camera/Camcorder") &gt;= 0) { keyString = this.pb.deviceKeys[i].deviceUri; break; } } if(keyString) { var formatObj = {imageCaptureFormat: this.pb[keyString].supportedImageFormats[0]}; this.$.mediaCapture.load(keyString, formatObj); } }, </code></pre> <p><strong>D. Inside the onclick Event of a certain button</strong></p> <pre><code>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"} ); }, </code></pre> <p>When I run the app on the HP TouchPad I get the next log in my console:</p> <blockquote> <p>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</p> </blockquote> <p>However when the app tries to load the mediaCapture Object I get:</p> <blockquote> <p>Uncaught TypeError: Cannot read property 'deviceKeys' of undefined, source/CCRecipesStep1View.js:186</p> </blockquote> <p>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:</p> <pre><code>onImageCaptureInitialized: function () { var keyString; for(var i = 0; i &lt; this.pb.deviceKeys.length; i++) &lt;&lt;------------ Here ... .. . } </code></pre> <p>The file MediaCapture.js and the instructions I follow talk about the <strong>"Property Bag"</strong> , 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.</p> <p>When the button is pressed I get:</p> <blockquote> <p>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</p> #----------- CHANGE PROPERTIES EVENT -----------######vuData , <p>/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140 [20111017-17:07:35.653586] info: MediaCapture::ServiceProxy</p> #----------- CHANGE PROPERTIES EVENT -----------######vuData , <p>/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140 [20111017-17:07:35.885940] info: MediaCapture::ServiceProxy</p> #----------- CHANGE PROPERTIES EVENT -----------######vuData , <p>/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140</p> </blockquote> <p>And start an infinite loop :S</p> <p>I hope you cal help me. This App is very important.</p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload