Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MxtWebArOptions

Defines an interface for the options passed into the constructor of MxtWebArPregenerated

Properties

  • apiKey: string - required - client’s access key to WebAR

  • clientId: string - required - client’s id

  • serviceEnvironment: MxtAssetEnvironment - optional - the service endpoint state. Defaults to Production if not provided.

  • assetEnvironment: MxtAssetEnvironment - optional - the asset state. Defaults to Production if not provided.

...

MxtWebArAssetOptions extends MxtWebArUrlOptions

Defines an interface for the options used for calculating a webAR asset

Properties

  • lod: LOD - optional - level of depth (texture size). Acceptable values are 128, 256, 512, 1024, or 2048

  • typeOverride: WebArType - optional - By default we will get asset matching current browser; if you want a specific asset regardless of browser (usdz vs glb, provide type override here)

...

MxtWebArPregenerated

Class for retrieving URLs of pregenerated WebAR assets

Constructor

new MxtWebArPregenerated(options: MxtWebArOptions): MxtWebArPregenerated

Properties

Methods

async getWebArPregeneratedUrl(sku:string, options:MxtWebArPregenAssetOptions): 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

  • sku: string - The sku of the product to get the web AR asset for

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. Use for viewing the model in a GLB viewer. 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

  • sku: string - The sku of the product to get the GLB asset for

  • Optional - lod: LOD - level of depth (texture size). Acceptable values are 128, 256, 512, 1024, or 2048

Returns a promise to the GLB file path

...