Camera Module Reference
The Camera Module provides photo capture, managed streaming (cloud-orchestrated HLS/DASH/WebRTC), and unmanaged streaming (direct to your endpoint via SRT, RTMP, or WHIP).Overview
Access the camera module through your app session:Photo Functionality
requestPhoto()
Request a photo from the connected smart glasses.Parameters
| Parameter | Type | Description |
|---|---|---|
options | PhotoRequestOptions | Optional configuration for the photo request |
PhotoRequestOptions
Compression Options
Thecompress option controls image compression during webhook upload to optimize network transfer speed. Defaults to "none" (no compression).
| Level | Dimensions | JPEG Quality | Typical Size Reduction | Use Case |
|---|---|---|---|---|
"none" | Original | Original | 0% (no compression) | High-quality photos, fast WiFi |
"medium" | 75% scale | 80% quality | ~50-60% smaller | Balanced quality/speed |
"heavy" | 50% scale | 60% quality | ~75-85% smaller | Slow connections, large photos |
- Compression only applies to webhook uploads (WiFi/cellular)
- BLE transfers use a different ultra-aggressive compression (AVIF format, 10-15KB) regardless of this setting, controlled by the
sizeparameter - Aspect ratio is always preserved
- Uses JPEG format with bilinear scaling for high-quality results
Understanding Webhook vs BLE Compression
MentraOS uses two different compression algorithms depending on the transfer method: Webhook Compression (controlled bycompress option):
- Format: JPEG
- Algorithm: Percentage-based dimension scaling + JPEG quality control
- Use case: WiFi/cellular uploads where bandwidth is measured in Mbps
- Result: 75-300KB files with good visual quality
size option):
- Format: AVIF (with JPEG fallback)
- Algorithm: Fit-within-box dimension constraint + ultra-low quality AVIF encoding
- Use case: Bluetooth fallback where bandwidth is ~50-100 KB/s
- Result: 10-15KB files with acceptable quality for thumbnails
- First attempts webhook upload (uses
compresssetting) - Falls back to BLE if webhook fails (uses aggressive AVIF compression based on
size)
Returns
Returns aPromise<PhotoData> that resolves with the captured photo data.
PhotoData Interface
Example
Managed Streaming Functionality (Recommended)
Managed streaming provides zero-infrastructure streaming where the cloud handles ingest and returns HLS/DASH URLs for viewing. Multiple apps can access the same managed stream simultaneously.startLivestream()
Start a managed stream with automatic URL generation.Parameters
| Parameter | Type | Description |
|---|---|---|
options | ManagedStreamOptions | Optional configuration for the managed stream |
ManagedStreamOptions
ManagedStreamResult
Example
stopLivestream()
Stop the current managed stream.checkExistingStream()
Check if there’s an existing active stream (managed or unmanaged) for the current user.StreamCheckResult Interface
Example
Managed Stream Status Monitoring
onLivestreamStatus()
Subscribe to managed stream status updates.ManagedStreamStatus
Example
Unmanaged Streaming Functionality
Unmanaged streaming sends the camera feed directly to your ingest endpoint. You choose the protocol via the URL scheme. Only one unmanaged stream can be active at a time, and it blocks other apps from using the camera.startLocalLivestream()
Start an unmanaged stream to a specified URL.Parameters
| Parameter | Type | Description |
|---|---|---|
options | StreamOptions | Configuration options for the stream |
StreamOptions
VideoConfig
AudioConfig
StreamConfig
Example
stopLocalLivestream()
Stop the current unmanaged stream.Unmanaged Stream Status Monitoring
onLocalLivestreamStatus()
Subscribe to unmanaged stream status updates.StreamStatusHandler
StreamStatus
Example
Unmanaged Stream Utility Methods
isCurrentlyStreaming()
getCurrentStreamUrl()
getStreamStatus()
Streaming Comparison
| Feature | Managed Streaming | Unmanaged Streaming |
|---|---|---|
| Infrastructure Required | None | Your own ingest server |
| Protocols | Cloud-selected (SRT) | SRT, RTMP/RTMPS, WHIP |
| Multiple Apps Can Stream | Yes | No (Exclusive) |
| Blocks Other Apps | No | Yes |
| Viewer URLs Provided | HLS/DASH/WebRTC | You manage |
| Best For | Social media, prototypes, multi-app | Custom servers, exclusive access |
| Requires Internet | Yes | Depends on server location |
Error Handling
Photo Errors
- Timeout: Photo requests timeout after 30 seconds
- Cancellation: Requests can be cancelled manually or during session cleanup
- Device Errors: Camera unavailable or hardware issues
Stream Errors
- Already Streaming: Cannot start while any stream (managed or unmanaged) is active
- Invalid URL: URL must start with
srt://,rtmp://,rtmps://,http://, orhttps:// - Network Issues: Connection problems to ingest endpoint
- Device Limitations: Hardware doesn’t support requested configuration

