Web SDK
Use the Web SDK in browser applications with a short-livedtokenProvider flow from your backend.
If you want to evaluate the runtime before you wire in browser auth, start with the guided guest Workbench demo. This page is the integration path once you are ready to connect your own frontend.
Step 1: Install
Step 2: Set up a backend token endpoint
Your browser application must not embed long-lived API keys. Instead, create a backend endpoint that exchanges your API key for a short-lived access token:Step 3: Initialize the client
tokenProvider is called before each authenticated request, so it must always be able to return a fresh token.
Step 4: Create and release a MoveSpec
Step 5: Replay a browser video file
Step 6: Run a live camera session
startCamera() processes local camera frames until maxFrames is reached or the run is aborted, then finalizes the session and returns the result.
Manual session control
Use the lower-level session helpers for full control over realtime flow:Alternative configuration
Alternative configuration
Typed errors
The Web SDK exposes typed error classes for structured error handling:AuthError— authentication failuresAuthorizationError— permission or scope errorsCompatibilityError— SDK version is not compatible (update your SDK)RealtimeProtocolError— connection or session communication failureSessionStateError— session lifecycle violationsValidationError— request or MoveSpec validation failuresRateLimitError— rate limit exceeded (HTTP 429)
Browser requirements
tokenProvidermust be able to mint or fetch fresh short-lived bearer tokens repeatedly- Camera helpers require
navigator.mediaDevices.getUserMedia() - Replay and camera helpers need a browser environment with
fetch,WebSocket, and media APIs - If you keep the default MediaPipe asset URLs, your CSP and network path must allow Google Cloud Storage and jsDelivr
Compatibility
@mediapipe/tasks-vision0.10.32- Default WASM root:
@mediapipe/tasks-vision@0.10.32/wasm - Default model asset:
pose_landmarker_full/float16/1/pose_landmarker_full.task