session.camera.takePhoto captures a still on glasses that have a camera, like
Mentra Live. It resolves after the photo is captured and uploaded, and hands you
back a download URL.
src/background/index.ts
CAMERA permission and glasses with a camera. Declare a
CAMERA permission in your manifest
so the call is allowed, and a CAMERA hardware requirement so the miniapp only
installs on glasses that can capture. Check session.capabilities.hasCamera
before calling so you don’t fire a request the glasses can’t satisfy.
Take a photo
takePhoto sends the request, waits while the glasses capture and the phone
uploads, then resolves with the photo metadata. The returned photoUrl is a
signed download URL with a short TTL (about 30 minutes), so fetch or display it
soon after.
Unknown runtime
transferMethod values are rejected instead of being treated as "auto".
The result is a PhotoTaken:
Field of view
setFov applies a temporary FOV/ROI override owned by the calling miniapp and
resolves after the ASG client reports it was applied. It applies to all captures
(photos and video) while that miniapp is active. When the miniapp closes, the host
restores the previous live miniapp override or the persistent base setting. The
factory/missing base is the centered standard preset (102 degrees); existing
saved user values are preserved.
It resolves with a
CameraFovResult:
Errors
Every method returns a promise that rejects with{ code, message } on failure.
Wrap calls in try/catch and read code.
Breaking change: photo compression
Photo compression now accepts exactlynone, low, medium, and high, sent
unchanged across the Mentra Miniapp SDK, Bluetooth SDKs, and glasses.
The default is none everywhere. Glasses encode these as JPEG Q95, Q88, Q78,
and Q60 respectively; size controls dimensions separately. none still uses
lossy JPEG encoding. Unknown values are rejected.
Cloud only allocates upload/download URLs: it takes no photo options and ignores
any request body. Photo compression is handled by the phone and glasses.
The former heavy spelling is removed; callers must use high. Android’s native
default changes from medium to none. Existing miniapps may therefore produce
different JPEG quality or payload sizes. There are no compatibility aliases or wire translations.
