Using Camera API allows to invoke the native camera application to record video or take a picture and receive a path to the file stored.
The methods are static and don't required to create an instance of a camera.
Note that the application will require the user to grant it input simulation and file api permissions for this extension to work on the BlackBerry.
Supported Platform(s)
- BlackBerry OS 5.0+ - BlackBerry PlayBook |
||||||||||||||||||||
- Supported Platform Table: Expand
|
Configuration Document Settings
To use all of the API described for this object, you must ensure the following settings are in your configuration document:
Feature Elements | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
You must declare the feature element(s) below in your configuration document: | ||||||||||
|
Permission Elements (PlayBook Only) |
---|
You must declare the permission element(s) below in your configuration document: |
- <rim:permit>use_camera</rim:permit> Permits your app to use the camera.
|
Functions
blackberry.media.camera.close
static void close() |
Supported Platform(s)
- BlackBerry OS 5.0+Description
Close the camera or video recorder if it's in the foreground.
Code Example(s)
function takeVideo() { try { blackberry.media.camera.takeVideo(successCB); } catch(e) { alert("Error in supported: " + e); } } function successCB(filePath) { blackberry.media.camera.close(); // do something with filePath } |
blackberry.media.camera.takePicture
static void takePicture(onCaptured : function, [onCameraClosed: function], [onError: function]) |
Supported Platform(s)
- BlackBerry OS 5.0+- BlackBerry PlayBook
Description
Opens the camera and return a path to the onCaptured callback when a photo is taken.
Parameter | Type | Description |
---|---|---|
onCaptured | function([filePath: String]) |
Method will be invoked when a picture is captured. Expected signature: function onCaptured(filePath)
filePath: Path to a picture captured by the camera. |
onCameraClosed |
function()
Optional |
Method will be invoked on camera closed event. Expected signature: function onCameraClosed()
|
onError |
function([e: String])
Optional |
Method will be invoked when an error occurs. Expected signature: function onError(e)
e: Error message |
blackberry.media.camera.takeVideo
static void takeVideo(onCaptured : function, [onCameraClosed: function], [onError: function]) |
Supported Platform(s)
- BlackBerry OS 5.0+- BlackBerry PlayBook
Description
Opens the camera and return a path to the onCaptured callback when a video is taken.
Parameter | Type | Description |
---|---|---|
onCaptured | function([filePath: String]) |
Method will be invoked when a video is recorded. Expected signature: function onCaptured(filePath)
filePath: Path to a video captured by the camera. |
onCameraClosed |
function()
Optional |
Method will be invoked on camera closed event. Expected signature: function onCameraClosed()
|
onError |
function([e: String])
Optional |
Method will be invoked when an error occurs. Expected signature: function onError(e)
e: Error message |
Code Example(s)
function takeVideo() { try { blackberry.media.camera.takeVideo(successCB, closedCB, errorCB); } catch(e) { alert("Error in supported: " + e); } } function successCB(filePath) { alert("Succeed: " + filePath); } function closedCB() { alert("Camera closed event"); } function errorCB(e) { alert("Error occured: " + e); } |
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Sep 14 2011 09:55:30 GMT-0000 (UTC)