Camera Module Reference
The Camera Module provides comprehensive camera functionality, including photo capture and both managed and unmanaged RTMP streaming capabilities. It allows apps to request photos from connected smart glasses and stream live camera feeds using two different approaches.Overview
The Camera Module is part of the App Session and provides three main capabilities:- Photo Capture: Request individual photos from smart glasses
- Managed Streaming: Zero-infrastructure streaming with automatic HLS/DASH URLs
- Unmanaged Streaming: Full-control streaming to custom RTMP endpoints
Photo Functionality
requestPhoto()
Request a photo from the connected smart glasses.Parameters
| Parameter | Type | Description |
|---|---|---|
options | PhotoRequestOptions | Optional configuration for the photo request |
PhotoRequestOptions
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 all RTMP endpoints and returns HLS/DASH URLs for viewing. Multiple apps can access the same managed stream simultaneously.startManagedStream()
Start a managed stream with automatic URL generation.Parameters
| Parameter | Type | Description |
|---|---|---|
options | ManagedStreamOptions | Optional configuration for the managed stream |
ManagedStreamOptions
ManagedStreamResult
Example
stopManagedStream()
Stop the current managed stream.Example
checkExistingStream()
Check if there’s an existing active stream (managed or unmanaged) for the current user.Returns
Returns aPromise<StreamCheckResult> with information about any active stream.
StreamCheckResult Interface
Example
Use Cases
- Reconnection: Apps can check for and reconnect to existing streams after restart
- Multi-app coordination: Detect if another app is already streaming
- Resource management: Avoid creating duplicate streams
- User experience: Inform users about existing streams before starting new ones
Managed Stream Status Monitoring
onManagedStreamStatus()
Subscribe to managed stream status updates.ManagedStreamStatus
Example
Unmanaged RTMP Streaming Functionality
Unmanaged streaming provides full control over RTMP endpoints but requires your own streaming infrastructure. Only one unmanaged stream can be active at a time, and it blocks other apps from using the camera.startStream()
Start an unmanaged RTMP stream to a specific URL.Parameters
| Parameter | Type | Description |
|---|---|---|
options | RtmpStreamOptions | Configuration options for the stream |
RtmpStreamOptions
VideoConfig
AudioConfig
StreamConfig
Example
stopStream()
Stop the current unmanaged RTMP stream.Example
Unmanaged Stream Status Monitoring
onStreamStatus()
Subscribe to unmanaged stream status updates.StreamStatusHandler
RtmpStreamStatus
Example
Unmanaged Stream Utility Methods
isCurrentlyStreaming()
Check if currently streaming (unmanaged).getCurrentStreamUrl()
Get the URL of the current unmanaged stream.getStreamStatus()
Get the current unmanaged stream status.Streaming Comparison
| Feature | Managed Streaming | Unmanaged Streaming |
|---|---|---|
| Infrastructure Required | None | RTMP Server |
| 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 scenarios | Custom servers, exclusive access |
| Requires Internet | Yes | No |
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
Unmanaged Stream Errors
- Already Streaming: Cannot start while any stream (managed or unmanaged) is active
- Invalid URL: RTMP URL validation failures
- Network Issues: Connection problems to RTMP endpoint
- Device Limitations: Hardware doesn’t support requested configuration

