ExternalFrameSource Class

Description

A external frame source represents a frame source not built-in in the EasyAR Sense. It is used for AR Engine, AR Foundation, HMD support, and customize your own frame source.

You can inherent a few sub types of ExternalFrameSource to implenment custom camera, but you cannot inherent ExternalFrameSource directly. Custom camera represnets a new device or data input method usaully.

Users using personal edition license or trial version Mega services can use EasyAR for 100 seconds per run when custom camera is chosen.


MonoBehaviour Messages

protected virtual void Awake()

protected virtual void OnApplicationPause(bool pause)

protected virtual void OnDestroy()


Properties

ReceivedFrameCount

C#

public int ReceivedFrameCount { get; }

Received frame count. Usually used for debug. There are usually hardware issues if this value stop to increase, and re-plug may help when using some devices like Nreal.

Camera

C#

internal protected virtual abstract 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.

IsCameraUnderControl

C#

internal protected virtual abstract 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.

IsHMD

C#

internal protected virtual abstract 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.

Display

C#

internal protected virtual abstract 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.

IsAvailable

C#

internal protected virtual abstract 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.

AvailableCenterMode

C#

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

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

All available center modes.


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.

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.

TryAcquireBuffer

C#

protected Optional< Buffer > TryAcquireBuffer(int size)

Try acquire buffer from buffer pool.

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.