Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Highlighted
Contributor
Posts: 20
Registered: ‎11-22-2011
My Device: blackberry bold- 9700
My Carrier: none

how to save a captured image from camera to a specific folder?

[ Edited ]

hi,

i am having problem saving captured image to a specific folder.

my config file:

 

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
	 version="1.0.0.0">
  <name>helloWorld</name>
  <content src="index.html"/>
  <feature id="blackberry.media.camera" />
  <icon src="icon.png"/>
  <access subdomains="true" uri="file://pictures"/>
</widget>

 my js code:

/*******
works when "Take Video" button clicked
********/
function takeVideo() {
    var result = blackberry.media.camera.takeVideo(onVideoCaptured, onCameraClosed, onError);
}

/*******
works when "Take Photo" button clicked
********/
function takePicture() {
    var result = blackberry.media.camera.takePicture(onPhotoCaptured, onCameraClosed, onError);
}


/*******
post processing of photo click event
********/
function onPhotoCaptured(filePath) {
    var img = new Image();
    img.src="file://" + filePath
    img.width = Math.round(screen.width / 2);

    document.getElementById("photoDetails").appendChild(img);
}


/*******
post processing of video click event
********/
function onVideoCaptured(filePath) {
    var video = document.createElement('video');
    video.src="file://" + filePath
    video.controls = "controls";
    video.width = Math.round(screen.width / 2);

    document.getElementById("videoDetails").appendChild(video);
}

function onCameraClosed(closedEvent) {
    alert("onCameraClosed: " + closedEvent);
}

function onError(errorEvent) {
    alert("onError: " + errorEvent);
}

 my application hangs in simulator when i click to capture after opening camera..

 

note: i have a web cam installed which i am used in sumulator. it opened successfully. but simulator hangs after capturing photo.

 

please help

 

Thank you