TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/CeeblueTV/wrts-client/llms.txt
Use this file to discover all available pages before exploring further.
Metadata class is the primary descriptor for a WebRTS stream. It is received via the onMetadata callback on Player or Source, and carries everything needed to configure playback: the protocol version negotiated with the server, the current live time, the full set of available tracks (audio, video, and data), and any DRM/content-protection configuration. Use the track arrays and filter methods to select the right quality level and codec before playback begins.
Constructor
A parsed JSON manifest object from the WRTS endpoint. The constructor reads the following fields:
version— protocol version string (e.g."1.2.3") or numbercurrentTime/liveTime— current live time in milliseconds (or seconds if a decimal is present; automatically converted)tracks[]— array of track descriptor objectscontentProtection[]— array of DRM descriptors keyed by KID
Static Methods
Fetches the stream manifest from a WRTS endpoint and returns a populated Returns
Metadata instance.
The live time is adjusted by half the round-trip time (RTT) of the fetch to compensate for network latency.Promise<Metadata> — resolves to the parsed metadata object.Properties
The WebRTS protocol version negotiated by the server, parsed from the
version field of the manifest.The
Date at which this Metadata instance was constructed. Useful for calculating the age of cached metadata.The current live time of the stream, in milliseconds. This value continuously advances using the wall clock — it stores the timestamp from the manifest and extrapolates forward based on elapsed time since the object was created. The setter records both the new value and the current wall-clock time so future reads extrapolate correctly.
All tracks indexed by their numeric track ID, sorted by descending bandwidth. Includes audio, video, and data tracks.
Audio-only tracks, sorted in descending order of bandwidth. The first element is the highest-quality audio track.
Video-only tracks, sorted in descending order of bandwidth. The first element is the highest-quality video track.
Data and subtitle tracks. Not sorted by bandwidth.
DRM settings keyed by KID (Key ID). Each key is a 32-character lowercase hex string. Values are
ContentProtection objects describing the encryption scheme, IV, and PSSH boxes for each DRM system.Methods
Deduplicates and re-sorts all tracks by descending bandwidth, then rebuilds the
up/down linked-list pointers on each MediaTrack. Call this after manually inserting tracks into Metadata outside of the constructor.Removes all audio tracks whose codec is not in the provided set. Repairs Returns
up/down pointers afterward.this — chainable.Removes all video tracks whose codec is not in the provided set. Repairs Returns
up/down pointers afterward.this — chainable.Removes all data/subtitle tracks whose codec is not in the provided set.Returns
this — chainable.MediaTrack Properties
Each entry intracks, audioTracks, videoTracks, and dataTracks is a MediaTrack instance. See the Media Types page for the full class reference. Key properties are:
Numeric track identifier. Matches the key used in
Metadata.tracks.Track type:
Media.Type.AUDIO, Media.Type.VIDEO, or Media.Type.DATA.Detected codec enum value, e.g.
Media.Codec.H264, Media.Codec.AAC, Media.Codec.OPUS.RFC 6381 codec descriptor string (e.g.
"avc1.640028", "mp4a.40.2").Maximum bandwidth in bytes per second (Bps). Used for sorting and ABR decisions.
Sample rate in Hz for audio tracks (e.g.
48000), or frames per second for video tracks (e.g. 25).{ width: number, height: number } — only meaningful for video tracks. Defaults to { width: 0, height: 0 }.Number of audio channels. Only meaningful for audio tracks.
ISO 639-2 language code (e.g.
"eng", "fra"). Present on audio and subtitle/data tracks when provided by the server.Codec-specific initialization data (e.g.
avcC, esds, dOps box contents). Required for initializing MSE SourceBuffer codec strings.The KID string linking this track to a
ContentProtection entry in Metadata.contentProtection.The next-higher-quality track of the same type in the sorted linked list.
undefined if this is the highest-quality track.The next-lower-quality track of the same type in the sorted linked list.
undefined if this is the lowest-quality track.ContentProtection Type
ContentProtection objects are stored in Metadata.contentProtection, keyed by KID.
The CENC protection scheme applied to encrypted samples.
| Value | Hex | Description |
|---|---|---|
ProtectionScheme.CENC | 0x63656e63 | AES-CTR full-sample encryption |
ProtectionScheme.CBC1 | 0x63626331 | AES-CBC full-sample encryption |
ProtectionScheme.CENS | 0x63656e73 | AES-CTR with sub-sample pattern |
ProtectionScheme.CBCS | 0x63626373 | AES-CBC with sub-sample pattern (default) |
The Key ID as a 32-character lowercase hex string (UUID without dashes).
The initialization vector as a hex string.
undefined when ivMode is 'sample' (each sample carries its own IV).How the IV is delivered:
'constant'— a single IV is reused for every sample, carried in the metadata'sample'— each sample’sMedia.Sample.ivfield carries a per-sample IV
Maps DRM system UUID (e.g.
"edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" for Widevine) to the base64-encoded PSSH box for that system.