Installation
Package Information
- Version: 0.1.5
- License: MIT OR Apache-2.0
- Repository: github:moq-dev/moq
- Dependencies:
@moq/signals,@moq/web-transport-ws
Core Concepts
MoQ Lite organizes media into a hierarchical structure:- Broadcast: A collection of tracks produced by a publisher
- Track: A live stream of groups within a broadcast (e.g., video, audio)
- Group: A stream of frames delivered independently over a QUIC stream
- Frame: A sized payload of bytes (codec bitstream)
Exports
Connection- Connect to MoQ relays and manage subscriptionsBroadcast- Publish and manage tracksTrack- Read/write groups in a trackGroup- Read/write frames in a groupPath- Path utilities for track namesTime- Timestamp utilitiesSignals- Re-export of @moq/signalsVarint- Variable-length integer encoding
Connection
Connecting to a Relay
Subscribing to a Broadcast
Publishing a Broadcast
Broadcast
TheBroadcast class handles writing and managing tracks.
Track
TheTrack class represents a live stream of groups.
Writing to a Track
Reading from a Track
Group
AGroup represents a sequence of frames delivered over a single QUIC stream.
Path and Time
Utility namespaces for working with paths and timestamps:Error Handling
All async operations can throw errors. Always use try/catch:closed promise:
Reactive State
MoQ Lite uses @moq/signals for reactive state management:Browser Support
MoQ Lite requires WebTransport support:- Chrome/Edge 97+
- Opera 83+
- WebTransport API enabled
Node.js Support
For Node.js, use a WebTransport polyfill:Zod Validation
Optional Zod schemas are available:Next Steps
@moq/hang
Add media encoding/decoding with WebCodecs
@moq/signals
Learn about the reactive signals library
@moq/watch
Use high-level watch component
@moq/token
Generate authentication tokens