Table of Contents

Class EasyARSession

命名空間
easyar

EasyARSession 在場景中控制AR會話,控制整個生命週期的數據流。這個組件是AR的入口。同一時刻不允許出現多個active的實例。EasyAR組件的所有功能必須在Session初始化完成之後才能使用。

EasyARSession

備註

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>;

參數

id

annotationID。

傳回值

{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;

參數

inputMode

GPS输入模式。

geoLocation

GPS信息。

傳回值

{void}

setPlaneDetectionErrorBehavior(behavior)

setPlaneDetectionErrorBehavior 設置微信小程式平面檢測異常時的行為

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

參數

behavior

传入回调函数。

傳回值

{void}

start(options)

start 啟動Session。

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

參數

options

options 启动选项,可选。

傳回值

{Promise<void>}

stop()

stop 停止Session,此時所有BlockController及Session使用的Tracker會被銷毀。

stop(): void;

傳回值

{void}