Class EasyARSession
- Namespace
- easyar
EasyARSession controls the AR session in the scene and manages 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 initialization is complete.
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 the current state of the Session
get state(): SessionState;
Property Value
Methods
xrCamera
Get the XRCamera in the scene used by the Session
get xrCamera(): xrfs.XRCamera;
Returns
dumpLog(signal)
dumpLog Starts and stops logging. 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 succeeds.
loadAnnotation(id: string): Promise<easyar.ema.IEma>;
Parameters
idannotationID。
Returns
{easyar.ema.IEma}
pause()
pause Pauses the AR session, stopping updates to Trackers and the camera (note that it will not be re-controlled by xrframe at this time).
pause(): void;
Returns
{void}
resume()
resume Resumes the AR session, restoring updates to Trackers and the camera.
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
inputModeGPS输入模式。
geoLocationGPS信息。
Returns
{void}
setPlaneDetectionErrorBehavior(behavior)
setPlaneDetectionErrorBehavior Sets the behavior when plane detection fails in the WeChat Mini Program.
setPlaneDetectionErrorBehavior(behavior: () => void): void;
Parameters
behavior传入回调函数。
Returns
{void}
start(options)
start Starts the Session.
start(options?: SessionStartOptions): Promise<void>;
Parameters
optionsoptions 启动选项,可选。
Returns
{Promise<void>}
stop()
stop Stops the Session, at which point all BlockControllers and Trackers used by the Session will be destroyed.
stop(): void;
Returns
{void}