Table of Contents

Class EasyARSession

Namespace
easyar

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 the EasyAR component can only be used after the Session is initialized.

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;

megaTracker

Get MegaTracker

get megaTracker(): easyar.MegaTracker;

state

Get the current status of the Session

get state(): SessionState;

Methods

xrCamera

Get the XRCamera used in the scene by the Session

get xrCamera(): xrfs.XRCamera;

Returns

dumpLog(signal)

Start and stop logging. Can be called at any time.

dumpLog(signal: boolean): string;

Parameters

signal

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

Returns

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

dumpSession(signal)

Start and stop recording Session data. Can be called at any time.

dumpSession(signal: boolean): string;

Parameters

signal

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

Returns

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

loadAnnotation(id)

Load annotations. Can only be called after Session.start succeeds.

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

Parameters

id

annotationID。

Returns

{easyar.ema.IEma}

pause()

Pause ARSession, updates for Tracker and camera will stop (note that it will not be re-controlled by xrframe at this time).

pause(): void;

Returns

{void}

resume()

Resume ARSession, updates for Tracker and camera will resume.

resume(): void;

Returns

{void}

setDeviceOrientation(deviceOrientation)

Set the current device orientation. Can be called at any time, takes effect immediately.

setDeviceOrientation(deviceOrientation: DeviceOrientation): void;

Parameters

deviceOrientation

当前设备朝向。

Returns

{void}

setGeoLocationInput(inputMode, geoLocation)

Set the current GPS input mode. Can only be called before Session.start, takes effect after start.

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

Parameters

inputMode

GPS输入模式。

geoLocation

GPS信息。

Returns

{void}

setPlaneDetectionErrorBehavior(behavior)

Set the behavior when plane detection is abnormal in the WeChat Mini Program.

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

Parameters

behavior

传入回调函数。

Returns

{void}

start(options)

Start Session.

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

Parameters

options

options 启动选项,可选。

Returns

{Promise}

stop()

Stop Session, at which time all BlockControllers and Trackers used by the Session will be destroyed.

stop(): void;

Returns

{void}