Table of Contents

Class EasyARSession

Namespace
easyar

Controls the AR session in the scene and controls the data flow of the whole lifecycle. This component is the entry point for AR. Multiple active instances are not allowed at the same time. All functions of EasyAR components can be used only after 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

Gets BlockHolder

get blockHolder(): BlockHolder;

megaTracker

Gets MegaTracker

get megaTracker(): easyar.MegaTracker;

state

Gets the current Session status

get state(): SessionState;

Methods

xrCamera

Gets the XRCamera in the scene used by the Session

get xrCamera(): xrfs.XRCamera;

Returns

dumpLog(signal)

Starts and stops log recording. Can be called at any time.

dumpLog(signal: boolean): string;

Parameters

signal

Pass true to start and false to stop.

Returns

{string} returns the file path; when starting, it returns a string with length 0.

dumpSession(signal)

Starts and stops Session data recording. Can be called at any time.

dumpSession(signal: boolean): string;

Parameters

signal

Pass true to start and false to stop.

Returns

{string} returns the file path; when starting, it returns a string with length 0.

loadAnnotation(id)

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

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

Parameters

id

annotationID。

Returns

{easyar.ema.IEma}

pause()

Pauses ARSession; updates of Tracker and camera will stop (note that they will not be controlled again by xrframe at this time).

pause(): void;

Returns

{void}

resume()

Resumes ARSession; updates of Tracker and camera will resume.

resume(): void;

Returns

{void}

setDeviceOrientation(deviceOrientation)

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

setDeviceOrientation(deviceOrientation: DeviceOrientation): void;

Parameters

deviceOrientation

Current device orientation.

Returns

{void}

setGeoLocationInput(inputMode, geoLocation)

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 input mode.

geoLocation

GPS information.

Returns

{void}

setPlaneDetectionErrorBehavior(behavior)

Sets the behavior when WeChat Mini Program plane detection is abnormal.

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

Parameters

behavior

Pass in a callback function.

Returns

{void}

start(options)

Starts Session.

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

Parameters

options

options startup options, optional.

Returns

{Promise}

stop()

Stops Session. At this time, all BlockController instances and Trackers used by the Session will be destroyed.

stop(): void;

Returns

{void}