develop wherever and whenever you want...
Docs > Camera Class Reference

Camera Class Reference

Summary 
Used to access the camera on the device. The camera object can be retrieved via a require statement at the top of your file.

Example 
deviceCamera = require("deviceCamera");

// by default, saveToCameraRoll is false. setting to true 
// will save the image in your devices camera roll 
// as well as to the current directory 
deviceCamera.saveToCameraRoll = true;

// onComplete called after the user has successfully 
// saved an image and has closed the camera UI 
deviceCamera.onComplete = function( fileName){ 
console.log( "filename of image taken: " + fileName); 
}

deviceCamera.onCancelled = function(){ 
console.log("Camera was cancelled"); 
}

// pass false to showCameraUI if you don't want 
// to allow the user to edit the image they take 
// before saving. pass true if editing is allowed 
deviceCamera.showCameraUI(false);

document.wait(); 


saveToCameraRoll 
A property on the camera object, used to tell Jasic whether or not to save the photo or video that user has taken to the devices camera roll or not. By default, this property has a "false" value.

bool saveToCameraRoll

Values 
true - Image or video will be saved to the camera roll, as well as to the local directory. 
false - Do not save to the camera roll, only to the local directory


onComplete 
A callback that can be installed that will be fired when the user has successfully taken a picture or video.

void onComplete(fileName)

Parameters 
fileName - The name of the file saved to the local directory. The file name is relative to the current directory.

Return Value 
none


onCancelled 
A callback that can be installed that will be fired if the user cancels out of the camera interface.

void onCancelled()

Parameters 
None

Return Value 
none


showCameraUI 
Call this method in order to bring up the iPad camera interface, allowing the user to take a photo or video within Jasic.

void showCameraUI(allowEditing)

Parameters 
allowEditing - true to allow the user to edit the taken photo before saving, else false.

Return Value 
none