CameraDeviceFrameSource Class

Description

MonoBehaviour which controls CameraDevice in the scene, providing a few extensions in the Unity environment. Use CameraDeviceFrameSource.Device directly when necessary.

This frame source is not a motion tracking device, and will not output motion data in a ARSession .

To choose frame source in runtime, you can deactive Camera GameObject and set all required values of all frame sources for availability check, and active Camera GameObject when this frame source is chosen.



MonoBehaviour Messages

protected override void OnEnable()

protected override void OnDisable()

protected virtual void OnDestroy()

protected virtual void Awake()


Fields

FocusMode

C#

public CameraDeviceFocusMode FocusMode

Focus mode used only when create CameraDeviceFrameSource.Device .

CameraSize

C#

public Vector2 CameraSize

Camera preview size used only when create CameraDeviceFrameSource.Device .

CameraOpenMethod

C#

public CameraDeviceFrameSource.CameraDeviceOpenMethod CameraOpenMethod

Camera open method used only when create CameraDeviceFrameSource.Device .

CameraIndex

C#

public int CameraIndex

Camera index used only when create CameraDeviceFrameSource.Device , used when CameraDeviceFrameSource.CameraOpenMethod == CameraDeviceFrameSource.CameraDeviceOpenMethod.DeviceIndex .


Properties

Device

C#

public CameraDevice Device { get; }

EasyAR Sense API. Accessible between CameraDeviceFrameSource.DeviceCreated and CameraDeviceFrameSource.DeviceClosed event if available.

IsAvailable

C#

public override Optional<bool> IsAvailable { get; }

If the frame source is available.

If the value equals null, FrameSource.CheckAvailability must be called and the value can be accessed after Coroutine finish. This property is used by ARComponentPicker when picking frame source.

AvailableCenterMode

C#

public override IReadOnlyList< ARSession.ARCenterMode > AvailableCenterMode { get; }

Available center mode of the frame source.

CameraPreference

C#

public CameraDevicePreference CameraPreference { get; set; }

Camera preference used only when create CameraDeviceFrameSource.Device . It will switch focus mode to the preferred value, change the focus after this value changed if it not the desired case.

Parameters

C#

public CameraParameters Parameters { get; set; }

Camera parameters used only when create CameraDeviceFrameSource.Device . It is for advanced usage and will overwrite other values like CameraDeviceFrameSource.CameraSize .

Camera

C#

public virtual Camera Camera { get; set; }

Camera used by the frame source in an ARSession .

Each type of frame source has its own method to check if the camera is usable, and will reject value set if the camera is not usable by the frame source. This property is used by ARComponentPicker when picking frame source to determine if the frame source is available, and some frame source will automatic pick a usable Camera from active objects in the scene in the process if the value is not set. You can set this value to a usable Camera before session start. The value cannot be changed after ARSession is ready if the frame source is selected in the session.

Origin

C#

public virtual GameObject Origin { get; }

Origin of ARSession if the frame source can output motion tracking data.

Each type of motion tracking frame source has its own method to set the origin object containing some specific component. Some frame source will automatic pick a usable object from active objects in the scene or generate an object if the value is not set.


Events

DeviceCreated

C#

public event Action DeviceCreated

Event when CameraDeviceFrameSource.Device created.

DeviceOpened

C#

public event Action DeviceOpened

Event when CameraDeviceFrameSource.Device opened.

DeviceClosed

C#

public event Action DeviceClosed

Event when CameraDeviceFrameSource.Device closed.


Methods

Open

C#

public void Open()

Open device.

Close

C#

public void Close()

Close device.

CheckAvailability

C#

public virtual System.Collections.IEnumerator CheckAvailability()

Coroutine to check frame source availability when FrameSource.IsAvailable equals null.