"call": the outgoing video of a phone-native meeting your
miniapp started with session.meeting.join(). A preview of the
glasses camera outside a call is not available yet; asking for "glasses" rejects with
unsupported.
src/background/index.ts
src/ui/CallScreen.tsx
Requirements
- Declare the
CAMERApermission inminiapp.json. - Your miniapp must own the active meeting. Previewing another miniapp’s call is not supported.
- Only one preview lease exists at a time. A second
preview()rejects withpreview_busy, and the first keeps delivering.
Who owns what
A preview has three parts with different lifetimes. Keeping them apart is what lets the UI come and go freely without interrupting anything.
The lease survives the UI closing and the WebView being destroyed. Reopening the UI and mounting
<StreamPreview> again picks the preview back up without a new preview() call.
Hide versus release
- Hide: unmount
<StreamPreview>(or let it size to zero). The phone stops producing frames, but the lease and the document’s connection stay open, so mounting it again shows video immediately. Use this for an eye toggle. - Release: call
handle.stop(). The lease ends and every connection to it closes. Do this when the call ends or the user turns the preview off for good. Ending the meeting releases the lease automatically.
paused: true in onStatus in the meantime.
session.stream.preview(options?)
Resolves with a
PreviewHandle:
Rejects with a
PreviewError whose code is one of the codes below.
<StreamPreview>
Mount the component before or after
preview() resolves; if the lease is not held yet it reports
waiting_for_lease and connects on its own as soon as it is. The picture is sized to the
rendered box and capped at 640×360 at 15 fps; resizing only reconfigures the phone when the size
tier changes.
Error and status codes
A preview failure never affects the call. Treat the preview as optional: keep showing your own
call UI when it is
waiting_for_lease or in an error state.
