CameraDeviceBaseBehaviour Class

Inherits: DeviceAbstractBehaviour

Description

CameraDeviceBaseBehaviour is the component to control CameraDevice in the AR scene.

It contains the entrance of AR chain, OpenAndStart .

Below code shows how to dynamically switch to Front camera when the Back camera is being used and the track is running.

ARBuilder.Instance.CameraDeviceBehaviours[0].Close();
ARBuilder.Instance.CameraDeviceBehaviours[0].CameraDeviceType = CameraDevice.Device.Front;
ARBuilder.Instance.CameraDeviceBehaviours[0].OpenAndStart();

Public Properties

bool HorizontalFlip (since 1.3.0)

Public Fields

CameraDevice.Device CameraDeviceType
float CameraFPS
Vector2 CameraSize
bool CaptureWhenStart
CameraDevice Device

Public Functions

void Close()
void OpenAndStart()
bool StartCapture()
bool StopCapture()

Public Events

event Action<CameraDeviceBaseBehaviour, bool> DeviceStart

Overwritten MonoBahaviour Functions

protected virtual void OnDestroy() protected virtual void Start()

CameraDevice.Device CameraDeviceType

Device type to open. It must be set before OpenAndStart.

float CameraFPS

Camera fps. The set must be called before OpenAndStart.

Vector2 CameraSize

Camera size. The set must be called before OpenAndStart.

bool HorizontalFlip (since 1.3.0)

The horizontal flip flag. When set, the camera image will be horizontal flipped from default.

bool CaptureWhenStart

Whether to open device and start capture at the MonoBehaviour.Start. If false, you must call OpenAndStart to bootup the AR chain.

CameraDevice Device

The CameraDevice object. You can reach advanced controls with Device. See CameraDevice for more details.

void Close()

Closes the camera and the whole connected AR chain will stop. You can change bindings using bind calls and camera devices using CameraDeviceType. Call OpenAndStart to restart.

void OpenAndStart()

Open the device of type CameraDeviceType and start capture immediately. See CameraDevice.Open and CameraDevice.Start for more details.

This is start point of the AR scene. All connections (all bind calls) except ImageTargetBaseBehaviour.Bind must be done before calling this function. It will use the connections established in the bind calls to bootup the whole AR scene.

bool StartCapture()

Starts the capture. See CameraDevice.Start for more details.

bool StopCapture()

Stops the capture. All connections and configurations are kept unchanged. See CameraDevice.Stop for more details.

event Action<CameraDeviceBaseBehaviour, bool> DeviceStart

The event for after OpenAndStart called.