Packs / xr-glasses-and-headsets-public
webxr-session-starter
Start an immersive WebXR VR or AR session from a button with feature detection, and fall back to an inline 3D view when XR is unavailable
Install
logicpacks pack use xr-glasses-and-headsets-public/webxr-session-starterget_pack xr-glasses-and-headsets-public/webxr-session-starterThe second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.
Keys it needs (names only)
None.
Playbooks included
- Spec:
spec/SPEC.md(goal, steps, edge cases, don’ts) - Routes:
static-local - Checks: 1 in
outcome/checks.yaml - Code:
index.htmlmain.js - Tools: python3, playwright-python, chromium
Usage, last 8 weeks
New: no recorded use yet.
Purpose (from spec/SPEC.md)
Goal
One page that works everywhere: on a headset it offers Enter VR / Enter AR (only for supported modes), elsewhere it renders the same scene inline with no errors.
Steps
- Copy
code/and serve over HTTPS (WebXR needs a secure context; localhost is allowed for development). - The page asks
navigator.xr.isSessionSupported()forimmersive-vrandimmersive-arand only shows buttons for supported modes. - Sessions start from a click (user activation) with
local-floorreference space andhand-trackingas an optional feature. - On session end the inline loop resumes.
- Check:
python3 ../tools/webgl_check.py code --js "window.__xr.mode === 'inline'". - On a headset: open the page in Quest Browser / Vision Pro Safari and enter VR (rubric).
Edge cases
- Vision Pro Safari: immersive-vr only (no immersive-ar for web pages at the time of writing).
- Quest Browser supports immersive-ar (passthrough).
- Reference space
local-floorcan be missing: the template falls back tolocal.
Don'ts
- Don't request a session on page load (it is rejected without a user gesture).
- Don't make features required unless the experience cannot work without them.