Skip to main content
Render the live scene from a MuJoCo camera, site, or body into a DOM <canvas> every frame. Each frame is rendered offscreen and blitted into the canvas, so it composites normally in the DOM — including inside opaque panels — and does not take over the render loop. This is the right tool for on-screen camera preview tiles (a wrist-cam pane, a scene-cam pane, a debug inset). It avoids the PNG encode/decode round-trip of the snapshot helpers, so it can run at full frame rate.
For the distinction between snapshots, live streams, and policy tensors, and when to use <CameraView> instead, see Cameras and Captures.

Signature

options accepts the same camera-selection and pose fields as captureCameraFrame (cameraName, siteName, bodyName, position + lookAt, width, height, fov, offsets, mujocoCameraCompatibility, and so on). Call the hook inside <MujocoCanvas> so it can render the scene; the <canvas> it draws into can live anywhere in the DOM.

Usage

Notes

  • Uses the async capture path, so Gaussian-splat (Spark) environments render through their dedicated capture renderer. Streaming a splat scene at full rate does not disturb the main view’s splat sort.
  • One capture is in flight at a time, so the stream self-limits to capture speed. Pass fps to cap it further, or paused to freeze the feed.
  • Unlike <CameraView> / useCameraViewport, this does not take over the render loop and is not occluded by opaque DOM over the canvas — prefer it for camera tiles embedded in HTML UI.
  • For policy inference you usually want a Float32Array instead of an on-screen canvas — use usePolicyCameraTensors.