Documentation Index
Fetch the complete documentation index at: https://mintlify.com/moqtail/moqtail/llms.txt
Use this file to discover all available pages before exploring further.
Track
ATrack represents a logical media or data stream identified by a unique name and namespace. Tracks can provide live content, historical (cached) content, or both.
Overview
Tracks are registered with the client viaaddOrUpdateTrack() to make them available for:
- Publishing - Serving live objects to subscribers
- Fetching - Providing historical objects from a cache
- Hybrid - Both live streaming and historical access
Type Definition
Properties
Globally unique identifier for the track.Consists of:
- namespace: Hierarchical tuple (e.g.
['video', 'camera1']) - name: Leaf identifier (string or bytes)
Hint controlling how objects should be delivered:
ObjectForwardingPreference.Subgroup- Use reliable ordered subgroups (default for most use cases)ObjectForwardingPreference.Datagram- Use unreliable datagrams for low-latency
This is advisory - the relay may override based on negotiated capabilities.
Defines where track content comes from. See TrackSource for details.Can provide:
- live:
ReadableStream<MoqtObject>for real-time publishing - past:
ObjectCachefor historical data retrieval - both: Hybrid live + cached content
Publisher priority for objects in this track.
- Range: 0 (highest priority) to 255 (lowest priority)
- Type: Number (fractional values are rounded, out-of-range values are clamped)
Optional compact numeric alias assigned during protocol negotiation.Automatically set by the protocol when a track is subscribed to or published. Do not set manually.
Usage Examples
Live-Only Track
Publish a real-time video stream from getUserMedia:Cached-Only Track
Serve pre-recorded content from a cache:Hybrid Track (Live + Cache)
Provide both live streaming and catch-up functionality:Low-Latency Datagram Track
Use datagrams for ultra-low latency streaming:Track Management
Adding/Updating Tracks
UseaddOrUpdateTrack() to register or modify a track:
fullTrackName already exists, it will be updated. Otherwise, a new track is registered.
Removing Tracks
Remove a track from the client’s catalog:Announcing Tracks
Before publishing, announce the track’s namespace:Unannouncing Tracks
Signal that a namespace is no longer available:FullTrackName
TheFullTrackName class represents a globally unique track identifier.
Constructor
Hierarchical namespace path:
- String: Slash-separated path (e.g.
'video/camera1') - Tuple: Array of namespace segments (e.g.
['video', 'camera1'])
Leaf track name:
- String: UTF-8 track name (e.g.
'h264') - Uint8Array: Raw bytes for binary names
TrackNameError- If namespace is empty, exceeds 32 fields, or total serialized length exceeds 4096 bytes
Methods
toString()
Returns human-readable representation:
serialize()
Serializes to wire format:
deserialize()
Parses from wire format:
ObjectForwardingPreference
Enum controlling object delivery mechanism:Subgroup (Reliable)
- Uses WebTransport unidirectional streams
- Guaranteed delivery and ordering within groups
- Higher latency but no loss
- Best for: Video, audio, critical data
Datagram (Unreliable)
- Uses WebTransport datagrams
- Low latency, may experience loss or reordering
- Requires datagram support enabled
- Best for: Game state, sensor data, disposable updates
Publisher Priority
ThepublisherPriority field helps relays allocate bandwidth efficiently:
Priority Behavior
- Lower values = higher priority = more bandwidth
- Range: 0-255 (fractional values rounded, out-of-range clamped)
- Relay decision: Relays use priority when congestion occurs
Priority is per-track, not per-object. All objects in a track share the same priority.
Best Practices
Caching Strategy: For hybrid tracks, consider cache size limits:
See Also
- Content Source - TrackSource interfaces and implementations
- MoqtObject - Object structure for track data
- Object Cache - Caching implementations
- MOQtailClient - Client methods for track management