11-28-2011 08:21 AM
Hello guys,
I am creating an application which the main functionality is taking photos. My problem is that after taking some photos I get 'Out of memory' alert and application crashes.
This situation happends on the 9860 device after taking 6-7 photos and on 9100 after taking few photos.
I am using latest SDK, memory card is inserted (and I am saving images on the memory card).
Does anyone have similar problem or know how to solve this problem??
Best Regards
Kamil
11-28-2011 12:55 PM
It should be something to do with the way captured images are handled. Make sure you release resources that not longer in use, in addition you can reduce Image Size through camera options to the lowest size; it would significantly reduce image size.
button below the post(s)
11-28-2011 11:40 PM - edited 11-28-2011 11:40 PM
i am facing problem also while taking pictures. my app just hangs when i capture image. i don't understand what i did wrong..
my configuration
<?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(onPhotoCapture d, 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").appendChil d(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").appendChil d(video);
}
function onCameraClosed(closedEvent) {
alert("onCameraClosed: " + closedEvent);
}
function onError(errorEvent) {
alert("onError: " + errorEvent);
}any help appreciated
thank you
11-29-2011 02:33 AM - edited 11-29-2011 03:03 AM
Hello Kamil_Micazook,
May I ask if you have any processes on the success callback of your takePicutre() method?
Hey tabzir,
I tried installing your application with a breeze. Everything went well, and the takePicture method returned with the proper filepath to the image. the only thing is that it did not display the image but otherwise, the application did not hang up.
11-29-2011 03:13 AM
11-29-2011 03:20 AM
11-29-2011 04:08 AM
Hello jdnoprada,
Thanks for reply. Here is my javascript code:
function capturePhoto()
{
blackberry.media.camera.takePicture( photoSuccess, onCameraClose, photoError );
}
function photoSuccess( path )
{
blackberry.media.camera.close();
if( path != null )
{
path = 'file://' + path;
var smallImage = document.getElementById('cameraImage');
smallImage.src=path;
}
}
function onCameraClose()
{
console.log( 'camera close' );
}
function photoError(e)
{
console.log( 'photo error ' + e );
}
Best Regards
Kamil
11-29-2011 04:37 AM
Hello Kamil_Micazook,
Well I don't see anything suspicious within your code. Could you check if your memory card has enough space? Or probably Tohman's answer on reducing the sizes of the images that you take (this requires you to adjust the image picture size, quality, etc.) is enough to solve the issue.
11-29-2011 04:41 AM
Hello jdnoprada,
Is there any way to set that (picture size, quality) programmatically? I know how to do that using PhoneGap, but how to set those options using pure WebWorks?
Thanks
Kamil
11-29-2011 10:20 AM - edited 11-29-2011 10:21 AM
Unfortunately the camera quality option is ignored by BlackBerry in PhoneGap apps too (note in the PhoneGap API the "BlackBerry Quirks" section says it "ignores the quality parameter").
It might be possible to do here in WebWorks, but would require somebody to write an extention to do so, which is not a trivial task.