Table of Contents

Class EasyARSession

Namespace
easyar

EasyARSession controls AR sessions in the scene, managing the data flow throughout the lifecycle. This component is the entry point for AR. Multiple active instances are not allowed at the same time. All features of EasyAR components can only be used after the Session initialization is complete.

EasyARSession

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the EasyARSession class.

Properties

blockHolder

Get BlockHolder

get blockHolder(): BlockHolder;

Property Value

megaTracker

Get MegaTracker

get megaTracker(): easyar.MegaTracker;

Property Value

state

Get Session current status

get state(): SessionState;

Property Value

Methods

xrCamera

Get the XRCamera used by the Session in the scene

get xrCamera(): xrfs.XRCamera;

Returns

dumpLog(signal)

dumpLog starts and ends log recording. Can be called at any time.

dumpLog(signal: boolean): string;

Parameters

signal

传入true为开始,false为结束。

Returns

{string} 返回文件路径,开始时返回为长度0的字符串。

loadAnnotation(id)

loadAnnotation loads annotations. Can only be called after Session.start is successful.

loadAnnotation(id: string): Promise<easyar.ema.IEma>;

Parameters

id

annotationID。

Returns

{easyar.ema.IEma}

pause()

pause pauses the ARSession; updates to Tracker and camera will stop (note: it will not be taken over by xrframe at this time).

pause(): void;

Returns

{void}

resume()

resume resumes the ARSession; updates to Tracker and camera will resume.

resume(): void;

Returns

{void}

setDeviceOrientation(deviceOrientation)

setDeviceOrientation sets the current device orientation. Can be called at any time and takes effect immediately.

setDeviceOrientation(deviceOrientation: DeviceOrientation): void;

Parameters

deviceOrientation

当前设备朝向。

Returns

{void}

setGeoLocationInput(inputMode, geoLocation)

setGeoLocationInput sets the current GPS input mode. Can only be called before Session.start and takes effect after start.

setGeoLocationInput(inputMode: easyar.GeoLocationInputMode, geoLocation?: easyar.GeoLocation): void;

Parameters

inputMode

GPS输入模式。

geoLocation

GPS信息。

Returns

{void}

setPlaneDetectionErrorBehavior(behavior)

setPlaneDetectionErrorBehavior sets the behavior when plane detection errors occur in WeChat Mini Programs.

setPlaneDetectionErrorBehavior(behavior: () => void): void;

Parameters

behavior

传入回调函数。

Returns

{void}

start(options)

start starts the Session.

start(options?: SessionStartOptions): Promise<void>;

Parameters

options

options 启动选项,可选。

Returns

{Promise<void>}

stop()

stop stops the Session; at this time, all BlockControllers and Trackers used by the Session will be destroyed.

stop(): void;

Returns

{void}