RTMP Streaming
MentraOS supports two streaming modes: managed streaming (cloud-orchestrated) and unmanaged streaming (direct RTMP to your endpoint). This document provides a concise reference and guidance for choosing and integrating each mode.Types of streaming
Managed Streaming
Managed streaming delegates ingest and playback to the MentraOS cloud. The SDK requests a stream, and the cloud returns viewer URLs (HLS/DASH, optional WebRTC). Multiple apps can consume the same managed stream concurrently.- Requires internet connectivity
- Non-exclusive camera access (cooperative with other MentraOS apps)
- Playback URLs become usable when status is “active”
Reference
- Method:
session.camera.startManagedStream(options?: ManagedStreamOptions): Promise<ManagedStreamResult> - Stop:
session.camera.stopManagedStream(): Promise<void> - Status events:
session.camera.onManagedStreamStatus(handler) - Status stream type:
StreamType.MANAGED_STREAM_STATUS
- hlsUrl: HTTP Live Streaming (HLS) manifest. Broadest player support on web and mobile; recommended default for viewers.
- dashUrl: MPEG-DASH manifest. Alternative adaptive streaming format for DASH-capable players/environments.
- webrtcUrl: Low-latency playback endpoint (available when
enableWebRTCis true). Use for near real-time viewing with compatible players. - previewUrl: Hosted player page suitable for quick testing and simple embedding. Useful for rapid validation without integrating a custom player.
- thumbnailUrl: Static/periodic thumbnail image for previews and UI cards; not a video stream.
- Do not present or share URLs to viewers until a status event with
status === "active"is received. - Treat
erroras non-recoverable for the current attempt. You may retry by callingstartManagedStream()again.
Unmanaged Streaming
Unmanaged streaming establishes a direct RTMP connection from the device to your RTMP endpoint. You control ingest, transcoding, and distribution.- Works with local or custom RTMP servers
- Exclusive camera access while active
- You manage endpoint availability, retries, and distribution
Reference
- Method:
session.camera.startStream(options: RtmpStreamOptions): Promise<void> - Stop:
session.camera.stopStream(): Promise<void> - Status events:
session.camera.onStreamStatus(handler) - Status stream type:
StreamType.RTMP_STREAM_STATUS
When to use each
- Managed streaming: use when you need turnkey ingest and globally accessible playback URLs (HLS/DASH; optional WebRTC), want cooperative camera access, or want cloud-managed resilience and URL lifecycle.
- Unmanaged streaming: use when you must stream to a custom/local RTMP endpoint, require full control of ingest and distribution, or operate without the MentraOS managed pipeline.
- All streaming requires the CAMERA permission in your app configuration.
- Only one unmanaged stream can run at a time per device and it blocks managed streams while active.
- Managed streams allow multiple apps to consume the same device feed.
Checking for existing streams
Usesession.camera.checkExistingStream() to detect if any stream is already active for the current user (managed or unmanaged). This is useful for reconnection, avoiding duplicate streams, and coordinating across multiple apps.
Signature:
- Managed streams support multiple apps; calling
startManagedStream()will join the existing managed stream for the user. - Unmanaged streams are exclusive and block other streams until stopped.
FAQ
-
How do I know when managed stream URLs are usable?
- Subscribe to
onManagedStreamStatusand wait forstatus === "active"before sharing or embedding.
- Subscribe to
-
Can I re-stream a managed stream to RTMP destinations like YouTube or Twitch?
- Yes. Provide
restreamDestinationsinManagedStreamOptions.
- Yes. Provide
-
How do I check for an existing active stream after an app restart?
- Call
session.camera.checkExistingStream()and inspectstreamInfo.
- Call
-
Does managed streaming require internet access?
- Yes. Unmanaged can work on local networks depending on your RTMP server reachability.
-
Can I enable low-latency viewing?
- Set
enableWebRTC: trueinManagedStreamOptions. UsewebrtcUrlfrom the result/status for playback.
- Set

