EditorCameraDeviceFrameSource Class

Description

MonoBehaviour which controls CameraDevice in the Unity Editor, only used for diagnostics purpose during developing. Usually everything you see does not represent real effect on your device when this frame source is used. You can develop app logic which is not relevant to AR effects, but can not judge AR running (detecting, tracking, localizing, etc.) effect according to the output

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


Fields

FocusMode

C#

public CameraDeviceFocusMode FocusMode

Focus mode used only when create CameraDeviceFrameSource.Device . Note: focus switch may not work on some devices due to hardware or system limitation.

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 .

CameraType

C#

public CameraDeviceType CameraType

Camera type used only when create CameraDeviceFrameSource.Device , used when CameraDeviceFrameSource.CameraOpenMethod == CameraDeviceFrameSource.CameraDeviceOpenMethod.DeviceType .

CameraIndex

C#

public int CameraIndex

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


Properties

IsAvailable

C#

internal protected override Optional<bool> IsAvailable { }

Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .

If the frame source is available.

If the value equals null, FrameSource.CheckAvailability will be called and the value will be accessed after Coroutine finish.

Device

C#

public CameraDevice Device { get; }

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

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 .

Index

C#

public Optional<int> Index { get; }

Camera index.

CameraCandidate

C#

public Camera CameraCandidate { get; set; }

CameraDeviceFrameSource.Camera candidate. It will be automatically get from the scene or generate if not set.

IsHMD

C#

internal protected override bool IsHMD { }

Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .

If the frame source represent head mounted devices. If true, diagnostics will be displayed on a 3D board in from of camera.

Some frame filter may work different on devices.

Camera

C#

internal protected override Camera Camera { }

Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .

On desktop or mobile phones, it represents the Camera in the virtual world in reflection of real world camera device, its projection matrix and transform will be set to reflect the real world camera, and it is controlled by EasyAR. On head mounted devices, it is only used to display some diagnostics message in front of your eyes, it is not used for camera image rendering, it is not controled by EasyAR.

Display

C#

internal protected override IDisplay Display { }

Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .

Provide display system information. You can use Display.DefaultSystemDisplay or Display.DefaultHMDDisplay for default display.

IsCameraUnderControl

C#

internal protected override bool IsCameraUnderControl { }

Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .

When the value is ture, the session will update camera transform depending on the center mode and render camera images.

When creating a HMD extension, it should be false. You should have full control of the 3D camera in the scene. You should handle camera rendering, especially in VST.

AvailableCenterMode

C#

internal protected override IReadOnlyList< ARSession.ARCenterMode > AvailableCenterMode { }

Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .

All available center modes.


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

OnSessionStart

C#

private override void OnSessionStart( ARSession session)

Provide only when creating a new frame source. It will only be accessed during ARSession.StartSession .

Handle session start if the frame source was assembled into ARSession.Assembly . It is designed for lazy initialization and you can do AR specific initialization work in the method.

Open

C#

public void Open()

Open device.

Close

C#

public void Close()

Close device.

OnSessionStop

C#

private override void OnSessionStop()

Provide only when creating a new frame source. It will be accessed during ARSession.StopSession or other session stop/break procedure.

Handle session stop if the frame source was assembled into ARSession.Assembly . You can use this method to destroy and resources created in ARSession.StartSession and during the session running and resotre inner state. It is ensured to be called before session destroy. If the frame source was destroyed before session, it will not be called and session will break.

CheckAvailability

C#

private virtual System.Collections.IEnumerator CheckAvailability()

Provide only when creating a new frame source. It will only be accessed during ARSession.Assemble .

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