...
Code Block |
---|
async function checkForWebArAsset(sku) { const browserArType = MxtWebAR.MxtWebArHelpers.browserArSupport(); const pregenerated = new MxtWebAR.MxtWebArPregenerated({apiKey:'myApiKey', clientId:'myClientId'}); try { const arAssetsAvailable = await pregenerated.getAssetTypesAvailable(sku); if(!browserArType) { //CANT USE WEB AR IN THIS BROWSER, if there are arAssetsAvailable, make a QR code or something to letdirect themthe seeuser itto onthe theirredirect mobilepage. device } else if(arAssetsAvailable.includes(browserArType)) { //Web AR Assets are available and work in this browser! } else { //Web AR Assets would work in this browser, but we don't have any! } } catch(e) { console.error('Failed to check if sku has web ar asset', e); } } |
...