Table of Contents

Class FrameSource

Namespace
easyar
Assembly
EasyAR.Sense.dll

A frame-source represents the data source for frame input data, providing image data or both image and motion data.

You can implement custom cameras by inheriting from some subtypes of FrameSource, but you cannot directly inherit from FrameSource. Custom cameras typically represent a new device or a new way of inputting data.

When using trial products (Personal Edition license, trial XR license, or trial Mega Service, etc.) with a custom camera or head-mounted display, EasyAR Sense will stop responding after a fixed, limited time upon each startup.

[DisallowMultipleComponent]
public abstract class FrameSource : MonoBehaviour
Inheritance
FrameSource
Derived

Properties

AvailableCenterMode

Provided only when creating a new frame-source. It is accessed only during the Assemble() process.

All available center modes.

protected virtual IReadOnlyList<ARSession.ARCenterMode> AvailableCenterMode { get; }

Property Value

Camera

Provided only when creating a new frame-source. It is accessed only during the Assemble() process.

On desktop or mobile devices, this camera represents the Camera in the virtual world corresponding to the real-world camera device. Its projection matrix and position will correspond to the real camera, controlled by EasyAR. On head-mounted displays, this camera is only used to display diagnostic text in front of the eyes, not for scene rendering, and the camera is not controlled by EasyAR.

protected abstract Camera Camera { get; }

Property Value

CameraFrameStarted

Provided only when creating a new frame-source. It is accessed throughout the lifetime of the ARSession.

Whether camera frame input has started.

protected abstract bool CameraFrameStarted { get; }

Property Value

DeviceCameras

Provided only when creating a new frame-source. It is accessed when CameraFrameStarted is true.

The device camera(s) providing camera frame data. If the camera frame data comes from multiple cameras, the list needs to include all of them.

Ensure the value is correct when CameraFrameStarted is true.

protected abstract List<FrameSourceCamera> DeviceCameras { get; }

Property Value

Display

Provided only when creating a new frame-source. It is accessed only during the Assemble() process.

Provides system display information. You can use DefaultSystemDisplay or DefaultHMDDisplay to get the default display information.

protected abstract IDisplay Display { get; }

Property Value

IsAvailable

Provided only when creating a new frame-source. It is accessed only during the Assemble() process.

Whether the current frame-source is available.

If the value equals null, CheckAvailability() will be called, and the value will be retrieved after the Coroutine finishes.

protected abstract Optional<bool> IsAvailable { get; }

Property Value

IsCameraUnderControl

Provided only when creating a new frame-source. It is accessed only during the Assemble() process.

When true, the session updates the camera's transform and renders the camera image.

When creating a head-mounted display extension, this should be false. You should fully control the 3D camera in the scene. You should handle camera rendering, especially in VST mode.

protected abstract bool IsCameraUnderControl { get; }

Property Value

IsHMD

Provided only when creating a new frame-source. It is accessed only during the Assemble() process.

Whether the current frame-source is a head-mounted display. If it is a head-mounted display, diagnostic information will be displayed on a 3D board in front of the camera.

Some frame filters may behave differently on head-mounted devices.

protected abstract bool IsHMD { get; }

Property Value

Methods

CheckAvailability()

Provided only when creating a new frame-source. It is accessed only during the Assemble() process.

The Coroutine used to check if the frame-source is available when IsAvailable equals null.

protected virtual IEnumerator CheckAvailability()

Returns

OnSessionStart(ARSession)

Provided only when creating a new frame-source. It is accessed only during the StartSession() process.

Handles session startup if this frame-source is assembled into Assembly. This method is designed for deferred initialization; you can perform AR-specific initialization work here.

protected abstract void OnSessionStart(ARSession session)

Parameters

session

OnSessionStop()

Provided only when creating a new frame-source. It is accessed during StopSession(bool) or other session stopping/corruption processes.

Handles session stopping if this frame-source is assembled into Assembly. You can use this method to destroy resources created during StartSession() and session runtime, and restore the internal state. This method is guaranteed to be called before the session is destroyed. If the frame-source is destroyed before the session, it will not be called, and the session will be corrupted.

protected abstract void OnSessionStop()