Skip to main content

Overview

VideoManager handles RTMP (Real-Time Messaging Protocol) streaming within a user session. It manages the lifecycle of video streams, tracks stream health through keep-alive mechanisms, handles acknowledgments, and ensures reliable communication between apps and smart glasses for video streaming. File: packages/cloud/src/services/session/VideoManager.ts

Key Features

  1. Stream Lifecycle Management: Tracks streams from initialization to termination
  2. Keep-Alive Mechanism: Maintains stream health with periodic heartbeats
  3. ACK Tracking: Monitors acknowledgments to detect connection issues
  4. Conflict Management: Prevents conflicts with managed streaming sessions
  5. Multi-Stream Support: Handles multiple concurrent streams per session
  6. Status Broadcasting: Notifies apps of stream status changes
  7. Timeout Detection: Automatically cleans up stale streams

Architecture

Stream Management

Stream Information Structure

Stream Creation

Keep-Alive Mechanism

Keep-Alive Configuration

Keep-Alive Scheduling

Keep-Alive Message

ACK Tracking

ACK Management

Missed ACK Handling

Status Management

Status Updates from Glasses

Status Broadcasting

Stream Termination

Stop Stream Request

Resource Cleanup

Configuration Options

Video Configuration

Audio Configuration

Stream Configuration

Lifecycle Management

Disposal

Best Practices

  1. Use short IDs for BLE efficiency (streamId, ackId)
  2. Validate RTMP URLs before attempting connection
  3. Check for conflicts with managed streaming sessions
  4. Stop existing streams when starting new ones for same app
  5. Monitor ACKs closely to detect connection issues early
  6. Clean up resources properly on stream termination
  7. Broadcast status changes to keep apps informed

Integration Points

  • AppManager: Validates app state and sends messages
  • ManagedStreamingExtension: Checks for streaming conflicts
  • WebSocket: Communicates with smart glasses
  • SessionService: Broadcasts status to subscribed apps