Content:
- Properties
- Methods

Adds a camera view into your app to take pictures and record videos.

rvw = ui.addCameraView( parent, options, width, height ) → ui object: CameraView

The capture method returns the image data. To save the image in DroidScript, you can use the WriteFile method like this:

// capture an image
img = cam.capture("jpeg", "base64")
filePath = "image.jpeg"
app.WriteFile(filePath, img, "base64")

Likewise, the record method requires a callback to be called when the video data is ready. To save videos in DroidScript, you can use the WriteFile method like this:

// record a video
cam.record("mp4", "base64", onRecord)

// in your callback function
onRecord( data ) {
filePath = "video.mp4"
app.WriteFile(filePath, data, "base64")

}

Note: Don't forget to add permission to "Camera" and/or "Microphone" when you are taking videos.

These are the setter and getter properties for CameraView component.

Example - Camera app in DroidScript click to expand contents 

Example - Video recorder in DroidScript click to expand contents 

Properties

The following properties are available on the CameraView object:

capabilitiesObject
focusDistanceNumber
focusModeString
frameRateNumber
imageHeightNumber
imgObject
isoNumber
soundBoolean
sourceString
widthNumber

Methods

The following methods are available on the CameraView object:

capture( type, format ) → Object
getPixelData( format, left, top, width, height ) → Object
stop()