Details of the WebAR Asset API SDK
- 1 MxtWebArOptions
- 1.1 Properties
- 2 MxtWebArPregenerated
- 3 MxtWebArHelpers
- 4 MxtAssetEnvironment
- 4.1 Values
- 5 LOD
- 5.1 Values
- 6 WebArType
- 6.1 Values
These are the functions, methods, and classes that we use to create the WebAR SDK.
MxtWebArOptions |
---|
Defines an interface for the options passed into the constructor of MxtWebArPregenerated |
Properties
|
MxtWebArPregenerated |
---|
Class for retrieving URLs of pregenerated WebAR assets |
Constructornew MxtWebArPregenerated(options: MxtWebArOptions): MxtWebArPregenerated |
Properties
|
Methodsasync getWebArPregeneratedUrl(sku:string, lod?:LOD, title?:string, enableScaling?:boolean): Promise<string>Get a URL to the Web AR asset. Will automatically tack on anything to the URL required to auto open the web AR asset in the browser as an href. If you want to determine if an asset exists before making this call, use getAssetTypesAvailable Parameters
Returns a promise to a formatted string that can be href’ed to open the web AR asset in a browser. Note that for iOS, you may need to specially format the HTML elements that href this URL: see TODO async getAssetTypesAvailable(sku:string): Promise<WebArType[]>Check if a web AR asset exists for the given sku and type. Checks the client’s json manifest to determine this. This is a fast check, use this rather than getWebArPregeneratedUrl to determine if you should show AR-related UI on the page. Parameters
Returns a promise to an WebArType[] of the WebArTypes that we have assets for this particular sku async getGlb(sku:string, lod?:LOD): Promise<string>Get the raw GLB file path for the given SKU. If you want to link to it for someone to view the AR asset, use getWebArPregeneratedUrl as it will add the necessary data to view in browser. Parameters
Returns a promise to the GLB file path |
MxtWebArHelpers |
---|
Class with static helper functions for retrieving AR assets |
Methodsstatic browserArSupport(): WebArTypeGet the type of web AR asset that the current browser supports. Returns ‘glb' or 'usdz’ or null if WebAR cannot be viewed in this browser static isWebARAvailable(): boolean Check if the current browser allows WebAR. Returns true if current browser allows WebAR |
MxtAssetEnvironment |
---|
Defines an enum for the different asset environments available |
Values
|
LOD |
---|
Defines an enum for the LODs (level of detail) available. Defines the pixel size of the textures used. The lower the value, the smaller the Web AR file (faster download), but also the less realistic it will look. A nice happy medium between download speed and realism tends to be _512 or _1024 |
Values
|
WebArType |
---|
Defines an enum for the type of web ar assets available, dependent on browser. |
Values
|