Expand description
§moq-lite: Media over QUIC Transport
moq-lite is designed for real-time live media delivery with sub-second latency at massive scale.
This is a simplified subset of the official Media over QUIC (MoQ) transport, focusing on the practical features.
NOTE: While compatible with a subset of the IETF MoQ specification (see ietf::Version), many features are not supported on purpose.
Additionally, the IETF standard is immature and up to interpretation, so many implementations are not compatible anyway.
I highly highly highly recommend using moq-lite instead of the IETF standard until at least draft-30.
§API
The API is built around Producer/Consumer pairs, with the hierarchy:
- Origin: A collection of Broadcasts, produced by one or more Sessions.
- Broadcast: A collection of Tracks, produced by a single publisher.
- Track: A collection of Groups, delivered out-of-order until expired.
- Group: A collection of Frames, delivered in order until cancelled.
To publish media, create:
- Origin::produce to get an OriginProducer and OriginConsumer pair.
- OriginProducer::create_broadcast to create a BroadcastProducer.
- BroadcastProducer::create_track to create a TrackProducer for each track.
- TrackProducer::append_group for each Group of Pictures (GOP) or audio frames.
- GroupProducer::write_frame to write each encoded frame in the group.
To consume media, create:
- Origin::produce to get an OriginProducer and OriginConsumer pair.
- OriginConsumer::announced to discover new BroadcastConsumers as they’re announced.
- BroadcastConsumer::subscribe_track to get a TrackConsumer for a specific track.
- TrackConsumer::next_group to receive the next available group.
- GroupConsumer::read_frame to read each frame in the group.
§Advanced Usage
- Use FrameProducer and FrameConsumer for chunked frame writes/reads without allocating entire frames (useful for relaying).
- Use TrackProducer::create_group instead of TrackProducer::append_group to produce groups out-of-order.
Modules§
- coding
- Contains encoding and decoding helpers.
- ietf
- An implementation of the IETF MoQ specification.
- lite
- The low-level encoding for the moq-lite specification.
Structs§
- Broadcast
- A collection of media tracks that can be published and subscribed to.
- Broadcast
Consumer - Subscribe to abitrary broadcast/tracks.
- Broadcast
Producer - Receive broadcast/track requests and return if we can fulfill them.
- Client
- A MoQ client session builder.
- Frame
- A chunk of data with an upfront size.
- Frame
Consumer - Used to consume a frame’s worth of data in chunks.
- Frame
Producer - Used to write a frame’s worth of data in chunks.
- Group
- A group contains a sequence number because they can arrive out of order.
- Group
Consumer - Consume a group, frame-by-frame.
- Group
Producer - Create a group, frame-by-frame.
- Origin
- A collection of broadcasts that can be published and subscribed to.
- Origin
Consumer - Consumes announced broadcasts matching against an optional prefix.
- Origin
Producer - Announces broadcasts to consumers over the network.
- Path
- A broadcast path that provides safe prefix matching operations.
- Produce
- A named tuple of a producer and consumer for convenience.
- Server
- A MoQ server session builder.
- Session
- A MoQ transport session, wrapping a WebTransport connection.
- Time
Overflow - Timescale
- A timestamp representing the presentation time in a given scale. ex. 1000 for milliseconds.
- Track
- Track
Consumer - A consumer for a track, used to read groups.
- Track
Producer - A producer for a track, used to create new groups.
Enums§
- Error
- A list of possible errors that can occur during the session.
Constants§
- ALPNS
- The ALPN strings for supported versions.
- VERSIONS
- The versions of MoQ that are supported by this implementation.
Traits§
- AsPath
- A trait for types that can be converted to a
Path. - Send
Sync Error - A trait that is Send+Sync except on WASM.
Type Aliases§
- Origin
Announce - A broadcast path and its associated consumer, or None if closed.
- Path
Owned - An owned version of
Pathwith a'staticlifetime. - Result
- Time
- A timestamp representing the presentation time in milliseconds.