Skip to content

Type Alias: Track ​

Track = object

Describes a media/data track known to the client (either published locally or subscribed to).

Examples ​

Live only track

ts
const liveStream: ReadableStream<MoqtObject> = buildCameraStream()
const track: Track = {
  fullTrackName,
  trackSource: { live: new LiveTrackSource(liveStream) },
  publisherPriority: 0
}
client.addOrUpdateTrack(track)

Past only track (pre‑recorded cache)

ts
const cache = new MemoryObjectCache()
recording.forEach(obj => cache.add(obj))
const track: Track = {
  fullTrackName,
  trackSource: { past: new StaticTrackSource(cache) },
  publisherPriority: 64
}
client.addOrUpdateTrack(track)

Hybrid (cache + live)

ts
const cache = new MemoryObjectCache()
const liveStream = buildLiveReadableStream()
const track: Track = {
  fullTrackName,
  trackSource: new HybridTrackSource(cache, liveStream),
  publisherPriority: 8
}
client.addOrUpdateTrack(track)

Properties ​

fullTrackName ​

fullTrackName: FullTrackName

Globally unique identifier for the track.


publisherPriority ​

publisherPriority: number

0 (highest) .. 255 (lowest) priority advertised with objects. Values are rounded to nearest integer then clamped between 0 and 255.


trackAlias? ​

optional trackAlias?: bigint

Optional compact numeric alias assigned during protocol negotiation.


trackProperties? ​

optional trackProperties?: TrackProperty[]

Track properties advertised by the publisher. Set before calling publish() to include properties in the PUBLISH message. Populated automatically on the subscriber side when SUBSCRIBE_OK or FETCH_OK is received.


trackSource ​

trackSource: TrackSource

Accessors for live and/or past objects belonging to this track.