session.audio, session.camera, session.led, and session.location. Each manager provides methods for specific hardware features.
Audio Control
Control audio playback and text-to-speech on glasses.Text-to-Speech
Convert text to speech:Play Audio Files
Play audio from URL:Stop Audio
Audio Options
| Option | Type | Default | Description |
|---|---|---|---|
audioUrl | string | required | URL to audio file |
volume | number | 1.0 | Volume level (0.0-1.0) |
stopOtherAudio | boolean | true | Stop other audio before playing |
| Option | Type | Description |
|---|---|---|
voice_id | string | Voice ID to use |
model_id | string | Model ID (default: eleven_flash_v2_5) |
voice_settings | object | Voice parameters (stability, speed, etc.) |
volume | number | Volume level (0.0-1.0) |
Camera Control
Capture photos and stream video from camera-equipped glasses.Check Camera Availability
Take Photos
Basic photo capture:| Field | Type | Description |
|---|---|---|
filename | string | Photo filename |
url | string | Photo URL |
timestamp | Date | When photo was taken |
Photo Options
| Option | Type | Default | Description |
|---|---|---|---|
saveToGallery | boolean | false | Save to device gallery |
size | string | ’medium' | 'small’, ‘medium’, or ‘large’ |
compress | string | ’none' | 'none’, ‘medium’, or ‘heavy’ |
customWebhookUrl | string | - | Override default webhook URL |
authToken | string | - | Auth token for custom webhook |
RTMP Streaming
Start streaming:Managed Streaming
Zero-infrastructure streaming (MentraOS handles RTMP):LED Control
Control RGB LEDs on supported glasses.Check LED Availability
Turn LED On
Basic usage:Turn LED Off
LED Blink Pattern
LED Options
| Option | Type | Description |
|---|---|---|
color | string | ’red’, ‘green’, ‘blue’, ‘white’, etc. |
brightness | number | 0-255 (optional) |
ontime | number | Duration in milliseconds |
offtime | number | Off duration for blinking |
count | number | Number of blinks |
Location Access
Access GPS location from the user’s device.Subscribe to Location Updates
Continuous location updates:Get Latest Location
One-time location fetch:Location Data
| Field | Type | Description |
|---|---|---|
lat | number | Latitude |
lng | number | Longitude |
accuracy | number | Accuracy in meters |
altitude | number | Altitude in meters (optional) |
timestamp | number | When location was captured |
Accuracy Levels
| Level | Description |
|---|---|
high | Best accuracy, higher battery usage |
medium | Balanced accuracy and battery |
low | Lower accuracy, battery efficient |
Common Patterns
Audio Feedback
Photo on Button Press
LED Notifications
Location-Based Alerts
Streaming Control
Best Practices
Check Capabilities First
Check Capabilities First
Always verify hardware availability before using device features:
Handle Errors Gracefully
Handle Errors Gracefully
Device operations can fail - always handle errors:
Provide User Feedback
Provide User Feedback
Let users know what’s happening:
Clean Up Resources
Clean Up Resources
Stop streams and unsubscribe when done:
Permissions Required
Device features require specific permissions:| Feature | Permission | Notes |
|---|---|---|
| Audio playback | None | Always available |
| Camera (photo/video) | CAMERA | Set in dev console |
| LED control | None | If hardware available |
| Location | LOCATION | Set in dev console |
Set permissions in the Developer Console. Users approve them when installing your app.

