- Docs
- Build with the SDK
Errors, phone checks and the debug panel
Phone checks. Before the camera starts, detectCapabilities() reads what the phone can do: platform and browser, secure page, camera API, WebGL 2, WebAssembly and SIMD, WebXR AR, in-app browser, memory and cores, and a lowEnd flag. A session keeps the result in session.capabilities. With no WebGL at all it stops before asking for the camera.
Error screens. Every failure gets a screen that says what happened, what to do on this phone, and the right buttons. It speaks French or English, and the steps are for iPhone, Android or a computer.
| Code | What the person sees |
|---|---|
permission-denied | "The camera is blocked", steps to allow it in the browser settings, Try again. |
in-app-browser | "Open this page in your browser": steps for Safari or Chrome, Copy link, and on Android Open in Chrome. |
no-camera, not-supported, insecure-context | A clear explanation. No Try again, since a second try cannot help. |
in-use, overconstrained, aborted, and any other failure (for example a target file that cannot be loaded) | An explanation and Try again, which starts everything again. |
In-app browsers: Facebook, Instagram, Messenger, TikTok, Snapchat, LinkedIn, Line, WeChat, Pinterest and Twitter name themselves. WhatsApp and Telegram do not, but their web views are recognised by shape (an iPhone web view has no "Safari" in its user agent, an Android one has wv). From code: overlay.showError('permission-denied'), overlay.reportError(error), errorScreen(code, { language, platform }). The page must be served over HTTPS.
Debug panel. Add ?debug to the address (or debug: true in create(), debug: true on the A-Frame scene). A small box shows once a second: the state, the camera size and whether the video plays, screen frames per second, camera images per second, poses per second, the average and worst frame time, stutters (gaps over 50 ms), visible anchors, memory (Chrome), and the phone facts. It is built on PerformanceMonitor (new PerformanceMonitor(session), event stats), which allocates nothing in the frame loop.
- If the phone rotates, the tracker is rebuilt for the new video size.