Class EasyARSession
- 命名空间
- easyar
EasyARSession 在场景中控制AR会话,控制整个生命周期的数据流。 这个组件是AR的入口。同一时刻不允许出现多个active的实例。 EasyAR组件的所有功能必须在 Session 初始化完成之后才能使用。
备注
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.
属性
blockHolder
获取BlockHolder
get blockHolder(): BlockHolder;
megaTracker
获取MegaTracker
get megaTracker(): easyar.MegaTracker;
state
获取Session当前状态
get state(): SessionState;
方法
xrCamera
获取Session使用的场景中的XRCamera
get xrCamera(): xrfs.XRCamera;
返回
dumpLog(signal)
dumpLog 开始和结束记录日志。可随时调用。
dumpLog(signal: boolean): string;
参数
signal传入true为开始,false为结束。
返回
{string} 返回文件路径,开始时返回为长度0的字符串。
loadAnnotation(id)
loadAnnotation 加载标注。只能在Session.start成功后调用。
loadAnnotation(id: string): Promise<easyar.ema.IEma>;
参数
idannotationID。
返回
{easyar.ema.IEma}
pause()
pause 暂停ARSession,Tracker及相机的更新将停止(注意此时不会被xrframe重新控制)。
pause(): void;
返回
{void}
resume()
resume 恢复ARSession,Tracker及相机的更新将恢复。
resume(): void;
返回
{void}
setDeviceOrientation(deviceOrientation)
setDeviceOrientation 设置当前设备朝向。可随时调用,立即生效。
setDeviceOrientation(deviceOrientation: DeviceOrientation): void;
参数
deviceOrientation当前设备朝向。
返回
{void}
setGeoLocationInput(inputMode, geoLocation)
setGeoLocationInput 设置当前GPS输入模式。只能在Session.start前调用,start后生效。
setGeoLocationInput(inputMode: easyar.GeoLocationInputMode, geoLocation?: easyar.GeoLocation): void;
参数
inputModeGPS输入模式。
geoLocationGPS信息。
返回
{void}
setPlaneDetectionErrorBehavior(behavior)
setPlaneDetectionErrorBehavior 设置微信小程序平面检测异常时的行为
setPlaneDetectionErrorBehavior(behavior: () => void): void;
参数
behavior传入回调函数。
返回
{void}
start(options)
start 启动Session。
start(options?: SessionStartOptions): Promise<void>;
参数
optionsoptions 启动选项,可选。
返回
{Promise<void>}
stop()
stop 停止Session,此时所有BlockController及Session使用的Tracker会被销毁。
stop(): void;
返回
{void}