### Install Project Dependencies with npm Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/vuejs/README.md Installs all the necessary dependencies for the project using the npm package manager. This command should be run in the project's root directory. ```sh npm install ``` -------------------------------- ### Run Development Server with npm Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/vuejs/README.md Compiles and hot-reloads the application for development. This command starts a local development server, allowing for live updates as code changes. ```sh npm run dev ``` -------------------------------- ### Start HTTPS Server with Node.js Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/SETUP_GUIDE.md Instructions to install and run a local HTTPS server using Node.js and the 'http-server' package. This enables testing with SSL. ```bash # Install http-server globally npm install -g http-server # Start server with SSL http-server -S -p 8000 # Then visit: https://localhost:8000 ``` -------------------------------- ### Build Project for Production with npm Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/vuejs/README.md Compiles and minifies the project for production deployment. This command generates optimized build artifacts ready for serving. ```sh npm run build ``` -------------------------------- ### External Camera Stream Setup Source: https://context7.com/blippar/webar-sdk-example/llms.txt Provides instructions and a code example for setting up an external camera stream with the WebAR SDK for custom camera handling and optimal AR performance. ```APIDOC ## External Camera Stream For advanced use cases, you can provide your own camera stream to the SDK for custom camera handling. ### Description This section details how to configure and set an external camera stream for the WebAR SDK, ensuring optimal AR performance. ### Method Asynchronous JavaScript function `setupExternalCamera()` ### Parameters None directly for the function, but it uses `navigator.mediaDevices` and `WEBARSDK.SetCameraStream`. ### Request Example ```javascript // Camera configuration for optimal AR performance const CAMERA_CONFIG = { VIDEO_CONSTRAINTS: { facingMode: 'environment', // Use rear camera advanced: [{ focusMode: 'manual', focusDistance: 0 }] } }; async function setupExternalCamera() { try { // Get available video devices const devices = await navigator.mediaDevices.enumerateDevices(); const videoDevices = devices.filter(d => d.kind === 'videoinput'); // Select rear camera (usually last device on mobile) const selectedDevice = videoDevices[videoDevices.length - 1]; if (selectedDevice.deviceId) { CAMERA_CONFIG.VIDEO_CONSTRAINTS.deviceId = selectedDevice.deviceId; } // Request camera stream const stream = await navigator.mediaDevices.getUserMedia({ video: CAMERA_CONFIG.VIDEO_CONSTRAINTS }); // Pass stream to WebAR SDK WEBARSDK.SetCameraStream(stream); console.log('External camera stream set successfully'); } catch (error) { if (error.name === 'NotAllowedError') { console.error('Camera permission denied'); } else if (error.name === 'NotFoundError') { console.error('No camera found'); } } } // Initialize when SDK is ready WEBARSDK.SetAppReadyCallback(() => { setupExternalCamera(); }); ``` ### Response - Logs success message or error to the console. ### Response Example ``` External camera stream set successfully ``` (or specific error messages like 'Camera permission denied') ``` -------------------------------- ### Start HTTPS Server with Python Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/SETUP_GUIDE.md Commands to start a local HTTPS server using Python 3 or Python 2. This is required for camera access on most browsers. ```bash # Python 3 python -m http.server 8000 --bind 0.0.0.0 # Python 2 python -m SimpleHTTPServer 8000 # Then visit: https://localhost:8000 ``` -------------------------------- ### Install Project Files Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/readme.md This command copies the necessary files for the advanced surface tracking integration into your project directory. Ensure you have a project structure ready to receive these files. ```bash # Copy these files to your project: ├── index.html # Main HTML structure ├── styles.css # Modern styling ├── custom-handlers.js # Progress & error handlers ├── loader.js # Permission & camera handling └── README.md # This documentation ``` -------------------------------- ### Download and Extract WebAR SDK Sandbox Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/SETUP_GUIDE.md Instructions to clone the repository or download and extract the WebAR SDK sandbox files. This is the initial step to get the project files. ```bash # Download the sandbox files git clone cd webar-sdk-sandbox # Or download and extract the ZIP file unzip webar-sdk-sandbox.zip cd webar-sdk-sandbox ``` -------------------------------- ### A-Frame Surface Tracking with Blippar WebAR SDK Source: https://context7.com/blippar/webar-sdk-example/llms.txt An A-Frame example demonstrating surface tracking using the Blippar WebAR SDK. It includes SDK initialization, setting up callbacks for guide view, model placement, and reset events. The scene is configured with an AR camera, assets, and a stage for placing 3D models with user interaction controls. ```html ``` -------------------------------- ### WebAR SDK API Reference - Initialization and Tracking Source: https://context7.com/blippar/webar-sdk-example/llms.txt Provides essential WebAR SDK methods for initialization and controlling AR tracking. It includes functions to initialize the SDK, set up BabylonJS integration, and start or stop AR tracking. These are fundamental for setting up and managing the AR experience. ```javascript // Initialization WEBARSDK.Init(); WEBARSDK.InitBabylonJs(canvas, scene, camera, stage, uxControl); // Tracking Control WEBARSDK.StartTracking(); WEBARSDK.StopTracking(); ``` -------------------------------- ### A-Frame Face Tracking Setup with WebAR SDK Source: https://context7.com/blippar/webar-sdk-example/llms.txt This HTML snippet sets up an A-Frame scene for face tracking using the WebAR SDK. It includes necessary script includes, WebAR SDK initialization parameters, and A-Frame entities for camera, assets, video background, face mesh, and 3D model placement. The script section initializes the SDK and demonstrates how to fill face mesh areas. ```html ``` -------------------------------- ### BabylonJS Marker Tracking Initialization Source: https://context7.com/blippar/webar-sdk-example/llms.txt Initializes the WebAR SDK for marker tracking with BabylonJS. This setup allows for multi-marker experiences by mapping specific marker IDs to corresponding 3D meshes. The SDK then anchors AR content to detected markers. ```html ``` -------------------------------- ### A-Frame Marker Tracking Setup with Blippar SDK Source: https://context7.com/blippar/webar-sdk-example/llms.txt This HTML snippet initializes the Blippar WebAR SDK for marker tracking and configures an A-Frame scene. It includes necessary scripts, defines AR camera and assets, and sets up entities to display 3D models when specific image markers are detected. Marker IDs must be obtained from the Blippar Hub. ```html ``` -------------------------------- ### HTML Structure for WebAR Application Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/readme.md The `index.html` file provides the basic structure for the WebAR application. It includes placeholders for A-Frame and WebAR SDK setup, custom handler registration, camera stream, AR scene, and UI elements like permission dialogs and loading screens. ```html ``` -------------------------------- ### Initialize Blippar WebAR SDK Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/face-tracking/index.html Initializes the Blippar WebAR SDK. This is a prerequisite for using other SDK functionalities. No specific dependencies are mentioned, and it takes no arguments. ```javascript WEBARSDK.Init(); ``` -------------------------------- ### Camera and Permissions Logic in JavaScript Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/readme.md The `loader.js` file handles essential device interactions for WebAR. It manages iOS permission requests, camera stream setup, gyroscope access, and coordinates the initialization of the WebAR SDK. ```javascript // iOS permission handling // Camera stream setup // Gyroscope access management // SDK initialization coordination ``` -------------------------------- ### Initialize and Configure WebAR SDK Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/face-tracking/face-trynow.html Initializes the WebAR SDK and sets properties for face mesh rendering. It also configures the scene's environment with an equirectangular reflection map. ```javascript WEBARSDK.Init(); WEBARSDK.SetEyesMeshFilled(true); WEBARSDK.SetMouthMeshFilled(true); let reflectionMap = new THREE.TextureLoader().load("images/poly_haven_studio_1k.jpg"); reflectionMap.encoding = THREE.sRGBEncoding; reflectionMap.mapping = THREE.EquirectangularReflectionMapping; document.querySelector('a-scene').object3D.environment = reflectionMap; ``` -------------------------------- ### Initialize Babylon.js Engine and Scene for WebAR Source: https://github.com/blippar/webar-sdk-example/blob/main/babylon/marker-tracking/index.html Sets up the Babylon.js engine and creates a scene for WebAR applications. It handles engine creation, scene configuration, camera, lighting, and prepares for marker tracking. ```javascript var canvas = document.getElementById("renderCanvas"); var engine = null; var sceneToRender = null; var webarStage = null; var webarMarkerMeshMap = []; var scaleByFactor = function(obj, factor) { obj.scaling.x = obj.scaling.x * factor; obj.scaling.y = obj.scaling.y * factor; obj.scaling.z = obj.scaling.z * factor; } var createDefaultEngine = function() { return new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true, disableWebGL2Support: false }); }; var createScene = function () { var scene = new BABYLON.Scene(engine); scene.environmentTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("./models/environment.dds", scene); var camera = new BABYLON.UniversalCamera("camera1", new BABYLON.Vector3(0, 0, 0), scene); var light = new BABYLON.HemisphericLight("HemiLight", new BABYLON.Vector3(5, 10, -2), scene); light.intensity = 0.7; let webarMarkerMesh1 = new BABYLON.Mesh("webarMarkerMesh1", scene); let webarMarkerMesh2 = new BABYLON.Mesh("webarMarkerMesh2", scene); webarMarkerMeshMap.push({ markerId: "dddddddd-uuuu-mmmm-mmmm-yyyyyyy11111", markerMesh: webarMarkerMesh1 }); webarMarkerMeshMap.push({ markerId: "dddddddd-uuuu-mmmm-mmmm-yyyyyyy11111", markerMesh: webarMarkerMesh2 }); BABYLON.SceneLoader.ImportMesh(null, "./models/", "MaterialsVariantsShoe.glb", scene, function (meshes, particleSystems, skeletons) { let xQuat = new BABYLON.Quaternion(); for (mesh of meshes) { if (mesh.name !== '__root__') { mesh.setParent(webarMarkerMesh1); BABYLON.Quaternion.FromEulerAnglesToRef(-Math.PI / 2, 0, 0, xQuat); mesh.rotationQuaternion.multiplyInPlace(xQuat); scaleByFactor(mesh, 6); } } }); BABYLON.SceneLoader.ImportMesh(['Object_4', 'Object_6'], "./models/", "milk_bottle_1l.glb", scene, function (meshes, particleSystems, skeletons) { for (mesh of meshes) { if (mesh.name !== '__root__') { mesh.setParent(webarMarkerMesh2); mesh.position.y = -0.75; scaleByFactor(mesh, 5); } } }); WEBARSDK.InitBabylonJs(canvas, scene, camera, webarMarkerMeshMap); return scene; }; window.initFunction = async function() { var asyncEngineCreation = async function() { try { return createDefaultEngine(); } catch(e) { console.log("the available createEngine function failed. Creating the default engine instead"); return createDefaultEngine(); } } window.engine = await asyncEngineCreation(); if (!engine) throw 'engine should not be null.'; window.scene = createScene(); }; initFunction().then(() => { sceneToRender = window.scene; sceneToRender.executeWhenReady(function () { engine.runRenderLoop(function () { if (sceneToRender && sceneToRender.activeCamera) { sceneToRender.render(); } }); }); }); window.addEventListener("resize", function () { engine.resize(); }); ``` -------------------------------- ### Initialize and Configure Blippar WebAR SDK (JavaScript) Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/surface-tracking/index.html Initializes the Blippar WebAR SDK and sets up callback functions for various events such as starting and stopping the hand guide animation, video playback, AR model placement, and reset button clicks. This code assumes the WEBARSDK object is globally available. ```javascript WEBARSDK.Init(); WEBARSDK.SetGuideViewCallbacks( startGuideViewCallback = () => { console.log(" Start(ed) hand guide animation"); }, stopGuideViewCallback = () => { console.log(" Stop(ped) hand guide animation"); } ); WEBARSDK.SetVideoStartedCallback(() => { deskenv.parentNode.removeChild(deskenv); }); WEBARSDK.SetARModelPlaceCallback(() => { console.log("AR model placed"); }); WEBARSDK.SetResetButtonCallback(() => { console.log("Reset button clicked"); }); ``` -------------------------------- ### WebAR SDK API Reference - Camera and Callbacks Source: https://context7.com/blippar/webar-sdk-example/llms.txt Details methods for camera stream management and various callback functions in the WebAR SDK. This includes setting an external camera stream and registering callbacks for application readiness, video start, stage readiness, tracking stop, and surface tracking events. These are crucial for managing the AR lifecycle and user interactions. ```javascript // Camera Control WEBARSDK.SetCameraStream(mediaStream); // Callbacks - Lifecycle WEBARSDK.SetAppReadyCallback(callback); WEBARSDK.SetVideoStartedCallback(callback); WEBARSDK.SetStageReadyCallback(callback); WEBARSDK.SetTrackingStoppedCallback(callback); // Callbacks - Surface Tracking WEBARSDK.SetARModelPlaceCallback(callback); WEBARSDK.SetResetButtonCallback(callback); WEBARSDK.SetGuideViewCallbacks(startCb, stopCb); ``` -------------------------------- ### SDK API Reference Source: https://context7.com/blippar/webar-sdk-example/llms.txt A comprehensive reference of the WebAR SDK methods, categorized by functionality including Initialization, Tracking Control, Camera Control, Callbacks, and Face Tracking. ```APIDOC ## SDK API Reference Complete list of available SDK methods and their usage. ### Initialization - **`WEBARSDK.Init()`**: Initializes the SDK. Use when `auto-init` is set to `false`. - **`WEBARSDK.InitBabylonJs(canvas, scene, camera, stage, uxControl)`**: Initializes the SDK with BabylonJS specific components. ### Tracking Control - **`WEBARSDK.StartTracking()`**: Starts the AR tracking process. - **`WEBARSDK.StopTracking()`**: Stops the AR tracking process. ### Camera Control - **`WEBARSDK.SetCameraStream(mediaStream)`**: Sets an external media stream as the camera source. ### Callbacks - Lifecycle - **`WEBARSDK.SetAppReadyCallback(callback)`**: Registers a callback function to be executed when the SDK is initialized. - **`WEBARSDK.SetVideoStartedCallback(callback)`**: Registers a callback function to be executed when the camera video feed starts. - **`WEBARSDK.SetStageReadyCallback(callback)`**: Registers a callback function to be executed when the AR stage is ready. - **`WEBARSDK.SetTrackingStoppedCallback(callback)`**: Registers a callback function to be executed when AR tracking is stopped. ### Callbacks - Surface Tracking - **`WEBARSDK.SetARModelPlaceCallback(callback)`**: Registers a callback function to be executed when a model is placed on a detected surface. - **`WEBARSDK.SetResetButtonCallback(callback)`**: Registers a callback function to be executed when the reset button is clicked. - **`WEBARSDK.SetGuideViewCallbacks(startCb, stopCb)`**: Registers callback functions for the start and stop events of a guide view animation. ### Callbacks - Marker Tracking - **`WEBARSDK.SetMarkerDetectedCallback((markerId) => {})`**: Registers a callback function to be executed when a marker is detected. Receives the `markerId`. - **`WEBARSDK.SetMarkerLostCallback((markerId) => {})`**: Registers a callback function to be executed when a marker is lost. Receives the `markerId`. - **`WEBARSDK.SetAutoMarkerDetectionStyle(htmlEl, showInstructions)`**: Configures the UI style for automatic marker detection, including an HTML element and an option to show instructions. ### Face Tracking - **`WEBARSDK.SetEyesMeshFilled(boolean)`**: Sets whether the eyes in the face mesh should be filled. - **`WEBARSDK.SetMouthMeshFilled(boolean)`**: Sets whether the mouth in the face mesh should be filled. - **`WEBARSDK.GetMouthOpenedMagnitude()`**: Returns the magnitude of the mouth opening, ranging from 0 to 1. ``` -------------------------------- ### Configure SDK Parameters Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/SETUP_GUIDE.md HTML script tag showcasing various SDK configuration parameters like AR mode, auto-initialization, minimal UI, and debug mode. ```html ``` -------------------------------- ### Configure WebAR SDK Initialization Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/SETUP_GUIDE.md HTML script tag for initializing the WebAR SDK. It includes parameters for AR mode, auto-initialization, camera stream, and debugging. ```html ``` -------------------------------- ### CSS for WebAR Canvas Source: https://github.com/blippar/webar-sdk-example/blob/main/babylon/marker-tracking/index.html Styles the rendering canvas for the WebAR experience, ensuring it covers the entire screen and handles touch events appropriately. ```css #renderCanvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; touch-action: none; } ``` -------------------------------- ### Initialize Face Filter with JavaScript Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/face-tracking/face-trynow.html This line calls the `enableFaceFilter` function with an index of 0, indicating that the default face filter should be activated upon initialization. ```javascript // default filter enableFaceFilter(0); ``` -------------------------------- ### Add Custom 3D Models Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/SETUP_GUIDE.md HTML snippet demonstrating how to add custom 3D models (e.g., GLTF) within the 'webar-stage' entity in 'index.html'. ```html ``` -------------------------------- ### Configure A-Frame Scene Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/SETUP_GUIDE.md HTML snippet for configuring the A-Frame scene, including setting the license key and disabling default UI elements for a cleaner AR experience. ```html device-orientation-permission-ui="enabled: false" loading-screen="enabled: false"> ``` -------------------------------- ### BabylonJS Surface Tracking Initialization Source: https://context7.com/blippar/webar-sdk-example/llms.txt Initializes the WebAR SDK for surface tracking using BabylonJS. It requires a canvas, scene, camera, and stage mesh references. The SDK then manages AR content placement on detected surfaces and supports user gestures for interaction. ```html ``` -------------------------------- ### Custom WebAR SDK Handlers Source: https://context7.com/blippar/webar-sdk-example/llms.txt Shows how to implement custom loading screens, progress indicators, and error handling for the WebAR SDK using provided callback attributes and global functions. This allows for a more tailored user experience. ```html ``` -------------------------------- ### Add Blippar License Key Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/SETUP_GUIDE.md HTML snippet to add your Blippar license key to the A-Frame scene. This is essential for SDK authentication. ```html ``` -------------------------------- ### Vue.js Integration with WebAR SDK Source: https://context7.com/blippar/webar-sdk-example/llms.txt Demonstrates integrating the WebAR SDK into a Vue.js application using both the Composition API and Options API. It shows how to manage AR stage readiness and load scenes. ```vue ``` ```vue ``` -------------------------------- ### Configure License Key in HTML Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/readme.md Update the `index.html` file with your unique Blippar WebAR SDK license key. This key is essential for initializing and authenticating the SDK for use in your AR application. ```html ``` -------------------------------- ### CSS for Modern UI Styling Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/readme.md The `styles.css` file is responsible for the visual presentation of the WebAR application. It includes styles for a splash screen, responsive dialogs, smooth animations, and mobile-optimized layouts. ```css /* Beautiful splash screen with gradients */ /* Responsive permission dialogs */ /* Smooth animations and transitions */ /* Mobile-optimized layouts */ ``` -------------------------------- ### React Integration with WebAR SDK Source: https://context7.com/blippar/webar-sdk-example/llms.txt Integrates the WebAR SDK into a React application using component lifecycle methods and refs to manage the AR scene. It includes loading assets and handling tracking resets. ```jsx import React from 'react'; import ReactDOM from 'react-dom/client'; class SceneLoader extends React.Component { constructor(props) { super(props); this.state = { assetsReady: false }; } componentDidMount() { this.setState({ assetsReady: true }); } handleResetTracking = () => { window.WEBARSDK.SetTrackingStoppedCallback(() => { console.log("Tracking stopped"); window.WEBARSDK.StartTracking(); }); window.WEBARSDK.StopTracking(); }; render() { return (
{this.state.assetsReady && ( )}
); } } const root = ReactDOM.createRoot(document.getElementById("root")); root.render(); ``` -------------------------------- ### Scale 3D Model by Factor Source: https://github.com/blippar/webar-sdk-example/blob/main/babylon/surface-tracking/index.html A utility function to scale a 3D object in Babylon.js by a given factor across all its scaling axes (x, y, z). This is useful for adjusting the size of imported models. ```javascript var scaleByFactor = function(obj, factor) { obj.scaling.x = obj.scaling.x * factor; obj.scaling.y = obj.scaling.y * factor; obj.scaling.z = obj.scaling.z * factor; } ``` -------------------------------- ### Custom SDK Event Handlers in JavaScript Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/readme.md The `custom-handlers.js` file defines functions to manage SDK progress and errors. `customProgressHandler` displays loading progress and debugging information, while `customErrorHandler` provides user-friendly error messages and solutions. ```javascript // Custom progress handler with real SDK data function customProgressHandler(progress) { // Shows actual loading progress from SDK // Updates beautiful progress UI // Logs detailed debugging information } // Custom error handler with user-friendly messages function customErrorHandler(error) { // Displays helpful error dialogs // Handles different error types appropriately // Provides solutions for common issues } ``` -------------------------------- ### Handle UI Element Clicks for Filters and Palettes Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/face-tracking/face-trynow.html Attaches click event listeners to filter and palette buttons. When clicked, these functions call `enableFaceFilter` or `enableColorPalette` respectively, to update the AR experience. ```javascript var filterBtns = [ ff0, ff1, ff2, ff3, ff4 ]; var currentFilterIndex = 0; var paletteBtns = [ ff4a, ff4b, ff4c, ff4d ]; var currentPaletteIndex = 0; for (let i = 0; i < filterBtns.length; ++i) { filterBtns[i].addEventListener('click', () => { enableFaceFilter(i); }); } for (let i = 0; i < paletteBtns.length; ++i) { paletteBtns[i].addEventListener('click', () => { enableColorPalette(i); }); } ``` -------------------------------- ### Enable and Configure Color Palette with JavaScript Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/face-tracking/face-trynow.html This function enables and configures a color palette by toggling its visibility and setting the facemesh material color based on the selected palette button. It also updates the current palette index. ```javascript function enableColorPalette(activateIndex) { togglePalette(activateIndex); facemesh.setAttribute('material', 'color', paletteBtns[activateIndex].style.backgroundColor); currentPaletteIndex = activateIndex; } ``` -------------------------------- ### Customize Splash Screen Content Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/advanced-surface-tracking/readme.md Modify the `custom-handlers.js` file to personalize the splash screen. You can change the logo, text, and other elements to match your brand identity, providing a unique user experience. ```javascript // In custom-handlers.js, modify the splash content: loadingScreen.innerHTML = `
`; ``` -------------------------------- ### Set Custom Style for Auto Marker Detection Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/marker-tracking/index.html Allows setting a custom HTML layout and controlling the visibility of scan instructions for auto marker detection. The SetAutoMarkerDetectionStyle function takes an HTMLElement for the custom division and a boolean to indicate whether scan instructions should be shown. ```javascript /** * Sets custom style for auto marker detection(auto-marker-detection = true): * (1) Add your custom html layout for auto marker detection * (2) May disable scan instruction if needed, by default it is true * @param {HTMLElement} custom division * @param {boolean} showScanInstructions set it to false to disable it */ //WEBARSDK.SetAutoMarkerDetectionStyle(htmlElement, showScanInstructions) ``` -------------------------------- ### Initialize Blippar WebAR SDK with HTML Configuration Source: https://context7.com/blippar/webar-sdk-example/llms.txt Demonstrates how to load the WebAR SDK using a script tag and configure its behavior through HTML attributes. This includes setting tracking modes, UI elements, and permission handling. Manual initialization is shown for when 'auto-init' is set to 'false'. ```html ``` -------------------------------- ### Initialize and Configure WebAR SDK Source: https://github.com/blippar/webar-sdk-example/blob/main/aframe/marker-tracking/index.html Initializes the WebAR SDK and sets up callbacks for marker detection and loss. The SDK is initialized using WEBARSDK.Init(). Callbacks for marker detection and loss are registered using SetMarkerDetectedCallback and SetMarkerLostCallback respectively. These functions take a callback function that receives the markerId as an argument. ```javascript WEBARSDK.Init(); // Give a callback when the WebAR Marker is ready to track the marker image WEBARSDK.SetMarkerDetectedCallback((markerId) => { console.info('Marker is detected for marker id: ', markerId); }); // Give a callback when the WebAR Marker is lost WEBARSDK.SetMarkerLostCallback((markerId) => { console.info('Marker tracking is lost for marker id: ', markerId); }); ```