Packagecom.distriqt.extension.camera.device
Interfacepublic interface CameraDevice extends flash.events.IEventDispatcher

This class represents the main interface to the camera device.



Public Properties
 PropertyDefined By
  capturingImage : Boolean
[read-only] Whether a capture image process is currently taking place.
CameraDevice
  height : Number
[read-only] The current capture height, in pixels.
CameraDevice
  info : CameraDeviceInfo
[read-only] Information about this camera device
CameraDevice
  isRecordingVideo : Boolean
[read-only] Returns true if there is a current video recording session in progress.
CameraDevice
  isRecordingVideoSupported : Boolean
[read-only] Whether the current camera device supports video recording.
CameraDevice
  receivedFrames : Number
[read-only] The current frame count received.
CameraDevice
  width : Number
[read-only] The current capture width, in pixels.
CameraDevice
Public Methods
 MethodDefined By
  
captureImage(request:CaptureImageRequest = null):Boolean
CameraDevice
  
CameraDevice
  
disconnect():Boolean
Releases any access to the camera the application may hold.
CameraDevice
  
Get the available modes of operation for the camera, i.e.
CameraDevice
  
getFrameBuffer(destination:ByteArray):int
Copies the latest frame captured by the camera to the supplied byte array.
CameraDevice
  
Get the available preview modes of operation for the camera, i.e.
CameraDevice
  
Whether the specified mode is supported on the current device.
CameraDevice
  
isExposureSupported(mode:String):Boolean
Whether the exposure mode is supported on the specified camera device
CameraDevice
  
Whether the flash mode is supported on the specified camera device
CameraDevice
  
isFocusSupported(mode:String):Boolean
Whether the focus mode is supported on the specified camera device
CameraDevice
  
Whether the specified preview mode is supported on the current device.
CameraDevice
  
Whether the torch mode is supported on the specified camera device
CameraDevice
  
isWhiteBalanceSupported(mode:String):Boolean
Whether the White balance mode is supported on the specified camera device
CameraDevice
  
Allows you to control the capture mode of the camera.
CameraDevice
  
setExposureMode(mode:String):Boolean
Sets the exposure mode from one of the available modes.
CameraDevice
  
setExposurePointOfInterest(point:Point):Boolean
This function sets the point of interest for the camera use for exposure settings.
CameraDevice
  
setFlashMode(mode:String):Boolean
Sets the mode for the flash on the camera
CameraDevice
  
setFocusMode(mode:String):Boolean
Sets the focus mode from one of the available focus modes.
CameraDevice
  
setFocusPointOfInterest(point:Point):Boolean
This function sets the point of interest for the camera to focus on.
CameraDevice
  
Allows you to control the mode of operation of the camera.
CameraDevice
  
setWhiteBalanceMode(mode:String):Boolean
Sets the white balance mode from one of the available modes.
CameraDevice
  
startRecordingVideo(path:String, options:VideoOptions = null):Boolean
Starts recording video (and audio) to the specified file location.
CameraDevice
  
Stops any video recording session that is currently in progress.
CameraDevice
Property Detail
capturingImageproperty
capturingImage:Boolean  [read-only]

Whether a capture image process is currently taking place. If this is true then any calls to captureImage will fail.


Implementation
    public function get capturingImage():Boolean

See also

heightproperty 
height:Number  [read-only]

The current capture height, in pixels.


Implementation
    public function get height():Number
infoproperty 
info:CameraDeviceInfo  [read-only]

Information about this camera device


Implementation
    public function get info():CameraDeviceInfo
isRecordingVideoproperty 
isRecordingVideo:Boolean  [read-only]

Returns true if there is a current video recording session in progress.


Implementation
    public function get isRecordingVideo():Boolean
isRecordingVideoSupportedproperty 
isRecordingVideoSupported:Boolean  [read-only]

Whether the current camera device supports video recording.

You must initialise the camera before calling this.


Implementation
    public function get isRecordingVideoSupported():Boolean
receivedFramesproperty 
receivedFrames:Number  [read-only]

The current frame count received. This starts from 0 when the initialise function is called for the first time and then increments with each frame received by the camera.


Implementation
    public function get receivedFrames():Number
widthproperty 
width:Number  [read-only]

The current capture width, in pixels.


Implementation
    public function get width():Number
Method Detail
captureImage()method
public function captureImage(request:CaptureImageRequest = null):Boolean

Parameters

request:CaptureImageRequest (default = null) — Defines the parameters of the capture image such as saving to camera roll etc

Returns
Boolean — true if the capture process was started successfully. This may fail if there is already a capture in progress or if the camera is not initialised or if the device doesn't support this functionality.

See also

com.distriqt.extension.camera.events.CameraDataEvent.CAPTURED_IMAGE
com.distriqt.extension.camera.events.CameraEvent.CAPTURE_ERROR
captureImageResult()method 
public function captureImageResult():CaptureImageResult

Returns
CaptureImageResult
disconnect()method 
public function disconnect():Boolean

Releases any access to the camera the application may hold.

This will force any recording or other activities to stop so you should finalise any active operations before calling this function.

Any calls to this device after calling this function will be invalid.

Returns
Boolean
getCameraModes()method 
public function getCameraModes():Array

Get the available modes of operation for the camera, i.e. the list of resolutions that the camera can support when capturing images.

Returns
Array
getFrameBuffer()method 
public function getFrameBuffer(destination:ByteArray):int

Copies the latest frame captured by the camera to the supplied byte array.

The returned data will be in little endian format which we set on the ByteArray instance. Additionally we reset the position to the start of the ByteArray so it will be ready for use immediately after a call to this function.

Parameters

destination:ByteArray — A valid ByteArray instance to write the frame data into

Returns
int — The index of the received frame data, -1 if there was an error, eg the ByteArray was invalid

See also


Example
Retrieving the data for a video frame
         var videoDataByteArray:ByteArray = new ByteArray();
         
         Camera.instance.getFrameBuffer( videoDataByteArray );
         
         bitmapData.setPixels( 
             new Rectangle( 0, 0, Camera.instance.width, Camera.instance.height ), 
             videoDataByteArray 
         );
         
getPreviewModes()method 
public function getPreviewModes():Array

Get the available preview modes of operation for the camera, i.e. the list of resolutions that the camera can support for preview frames.

Returns
Array
isCameraModeSupported()method 
public function isCameraModeSupported(mode:CameraMode):Boolean

Whether the specified mode is supported on the current device. See the list of modes in the CameraModes class.

Parameters

mode:CameraMode — The camera mode to check support for

Returns
Booleantrue if the mode is supported on the device

See also

isExposureSupported()method 
public function isExposureSupported(mode:String):Boolean

Whether the exposure mode is supported on the specified camera device

Parameters

mode:String — The exposure mode to check support for

Returns
Boolean — true if the mode is supported on the device
isFlashSupported()method 
public function isFlashSupported():Boolean

Whether the flash mode is supported on the specified camera device

Returns
Boolean — true if it is supported
isFocusSupported()method 
public function isFocusSupported(mode:String):Boolean

Whether the focus mode is supported on the specified camera device

Parameters

mode:String — The focus mode to check support for

Returns
Boolean — true if the mode is supported on the device
isPreviewModeSupported()method 
public function isPreviewModeSupported(mode:CameraMode):Boolean

Whether the specified preview mode is supported on the current device.

Parameters

mode:CameraMode — The camera mode to check support for

Returns
Booleantrue if the mode is supported on the device

See also

isTorchSupported()method 
public function isTorchSupported():Boolean

Whether the torch mode is supported on the specified camera device

Returns
Boolean — true if it is supported
isWhiteBalanceSupported()method 
public function isWhiteBalanceSupported(mode:String):Boolean

Whether the White balance mode is supported on the specified camera device

Parameters

mode:String — The white balance mode to check support for

Returns
Boolean — true if the mode is supported on the device
setCameraMode()method 
public function setCameraMode(mode:CameraMode):Boolean

Allows you to control the capture mode of the camera.

You must have called initialise before using this function. You can set the initial mode by passing the options into the initialise function.

Parameters

mode:CameraMode

Returns
Boolean
setExposureMode()method 
public function setExposureMode(mode:String):Boolean

Sets the exposure mode from one of the available modes.

Parameters

mode:String — The exposure mode to set

Returns
Boolean — true if the mode was set correctly

See also

setExposurePointOfInterest()method 
public function setExposurePointOfInterest(point:Point):Boolean

This function sets the point of interest for the camera use for exposure settings.

This property represents a point where {0,0} corresponds to the top left of the picture area, and {1,1} corresponds to the bottom right in landscape mode with the home button on the right—this applies even if the device is in portrait mode.

Parameters

point:Point — The coordinates of the point of interest to set

Returns
Boolean
setFlashMode()method 
public function setFlashMode(mode:String):Boolean

Sets the mode for the flash on the camera

Parameters

mode:String — The flash mode to set from the available modes in CameraParameters.

Returns
Boolean

Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid

See also

setFocusMode()method 
public function setFocusMode(mode:String):Boolean

Sets the focus mode from one of the available focus modes.

Parameters

mode:String — The focus mode to set

Returns
Boolean — true if the mode was set correctly

See also

setFocusPointOfInterest()method 
public function setFocusPointOfInterest(point:Point):Boolean

This function sets the point of interest for the camera to focus on.

This property represents a point where {0,0} corresponds to the top left of the picture area, and {1,1} corresponds to the bottom right in landscape mode with the home button on the right—this applies even if the device is in portrait mode.

Parameters

point:Point — The coordinates of the point of interest to set

Returns
Boolean
setPreviewMode()method 
public function setPreviewMode(mode:CameraMode):Boolean

Allows you to control the mode of operation of the camera.

Parameters

mode:CameraMode

Returns
Boolean
setWhiteBalanceMode()method 
public function setWhiteBalanceMode(mode:String):Boolean

Sets the white balance mode from one of the available modes.

Parameters

mode:String — The white balance mode to set

Returns
Boolean — true if the mode was set correctly

See also

startRecordingVideo()method 
public function startRecordingVideo(path:String, options:VideoOptions = null):Boolean

Starts recording video (and audio) to the specified file location.

Parameters

path:String
 
options:VideoOptions (default = null)

Returns
Boolean — true if video recording was started successfully. false if the path was invalid or if a file already exists at that location or if there is already a recording in progress.
stopRecordingVideo()method 
public function stopRecordingVideo():Boolean

Stops any video recording session that is currently in progress.

Returns
Boolean