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.
MoqtObject
TheMoqtObject class is the fundamental unit of data in MOQtail, representing a single media or data object with associated metadata, location, and optional payload.
Overview
AMoqtObject encapsulates:
- Location - Group and object IDs
- Payload - Optional raw bytes (media frame, data chunk, etc.)
- Status - Object status (normal, end of group, end of track, does not exist)
- Metadata - Priority, forwarding preference, extension headers
- Track Identity - Full track name reference
Class Definition
Properties
Fully qualified track identifier this object belongs to
Position within the track:
{ group: bigint, object: bigint }Accessible via:location.grouporgroupIdlocation.objectorobjectId
Subgroup identifier for subgroup-forwarded objects.
null for datagram-forwarded objects.Publisher-assigned priority (0 = highest, 255 = lowest)
Delivery mechanism:
ObjectForwardingPreference.Subgroup- Reliable ordered deliveryObjectForwardingPreference.Datagram- Unreliable low-latency delivery
Status indicator:
ObjectStatus.Normal(0x0) - Object exists with payloadObjectStatus.DoesNotExist(0x1) - Object does not existObjectStatus.EndOfGroup(0x3) - End of group markerObjectStatus.EndOfTrack(0x4) - End of track marker
Optional extension headers (e.g., capture timestamp, audio level).
null if none.Raw object data bytes.
null for status-only objects.Convenience Getters
Factory Methods
newWithPayload()
Creates an object with payload data.
Track identifier
Object position (group, object)
Priority (0-255)
Delivery mechanism
Subgroup ID (required for Subgroup preference,
null for Datagram)Optional extension headers
Object data
newWithStatus()
Creates a status-only object (no payload).
Status code (cannot be
Normal)Conversion Methods
From Wire Formats
fromDatagramObject()
Converts a DatagramObject (received from datagrams) to MoqtObject.
fromDatagramStatus()
Converts a DatagramStatus to MoqtObject.
fromFetchObject()
Converts a FetchObject (from fetch streams) to MoqtObject.
fromSubgroupObject()
Converts a SubgroupObject (from subgroup streams) to MoqtObject.
To Wire Formats
tryIntoDatagramObject()
Converts to DatagramObject for transmission.
Track alias to use in wire format
Whether this is the last object in the group (Draft-14)
CastingError- If forwarding preference is notDatagramProtocolViolationError- If object status is notNormalor payload is missing
tryIntoDatagramStatus()
Converts to DatagramStatus for transmission.
CastingError- If forwarding preference is notDatagramProtocolViolationError- If object status isNormal
tryIntoFetchObject()
Converts to FetchObject for fetch responses.
CastingError- If forwarding preference is notSubgroupProtocolViolationError- If subgroupId is null
tryIntoSubgroupObject()
Converts to SubgroupObject for subgroup streams.
CastingError- If forwarding preference is notSubgroup
Utility Methods
Type Checks
Special Methods
getSubgroupHeaderType()
Determines the appropriate subgroup header type based on object properties.
Whether this object contains end-of-group or end-of-track status
Appropriate header type (0x10-0x1D)
isDatagramEndOfGroup() (Static)
Checks if a DatagramObject has the end-of-group flag set (Draft-14).
This is separate from
ObjectStatus.EndOfGroup - the flag indicates this is the last object in the group even with Normal status.Location Class
TheLocation class represents a position within a track.
Constructor
Group index (e.g., segment, GOP, logical group)
Object index within the group (e.g., frame, chunk)
Properties
Methods
equals()
Checks equality with another location.
compare()
Compares locations for ordering.
-1 if this < other, 1 if this > other, 0 if equal
serialize() / deserialize()
Usage Examples
Creating Objects
Processing Objects from Streams
Sending Objects
Best Practices
Datagram Constraints: Datagram objects should be small (typically < 1200 bytes) to avoid fragmentation:
See Also
- Track - Track definition and management
- Content Source - Creating object streams
- Object Cache - Caching objects
- MOQtailClient - Client methods