---
url: https://docs.moqtail.dev/ts/api/player/interfaces/CatalogElement.md
---
# Interface: CatalogElement

The catalog element, emitted with the player's `catalog` event.

## Extends

* [`SourceElement`](../classes/SourceElement.md)

## Implements

* [`CatalogReader`](CatalogReader.md)

## Properties

### context

> `protected` `readonly` **context**: [`ElementContext`](ElementContext.md)

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`context`](../classes/SourceElement.md#context)

***

### definition

> `readonly` **definition**: [`ElementDefinition`](ElementDefinition.md)

Set by `defineElement` once `init` resolves, so it can't be used from a constructor.

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`definition`](../classes/SourceElement.md#definition)

***

### namespace

> `readonly` **namespace**: [`Tuple`](../../model/classes/Tuple.md)

The catalog track's namespace.

#### Implementation of

`CatalogReader.namespace`

***

### pads

> `readonly` **pads**: [`Pad`](../classes/Pad.md)\[] = `[]`

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`pads`](../classes/SourceElement.md#pads)

***

### url

> `readonly` **url**: `string`

The catalog's session URL, `moqt://authority/path[?query]` without a fragment.

#### Implementation of

`CatalogReader.url`

## Accessors

### duration

#### Get Signature

> **get** **duration**(): `number`

Seconds: the longest `trackDuration` of the loaded sources' tracks, `Infinity` while live, `NaN` unknown.

##### Returns

`number`

***

### isComplete

#### Get Signature

> **get** **isComplete**(): `boolean`

##### Returns

`boolean`

#### Implementation of

`CatalogReader.isComplete`

***

### json

#### Get Signature

> **get** **json**(): `object` & `object` | `undefined`

The last good catalog document, deltas applied and variables substituted.

##### Returns

`object` & `object` | `undefined`

***

### publishTracks

#### Get Signature

> **get** **publishTracks**(): readonly (`object` & `object` & `object`)\[]

##### Returns

readonly (`object` & `object` & `object`)\[]

***

### stale

#### Get Signature

> **get** **stale**(): `boolean`

An update was missed or rejected since the last good catalog.

##### Returns

`boolean`

***

### streamType

#### Get Signature

> **get** **streamType**(): [`StreamType`](../type-aliases/StreamType.md)

From the tracks of the loaded sources.

##### Returns

[`StreamType`](../type-aliases/StreamType.md)

***

### tracks

#### Get Signature

> **get** **tracks**(): readonly (`object` & `object` & `object`)\[]

The last good catalog's tracks, roles inferred.

##### Returns

readonly (`object` & `object` & `object`)\[]

#### Implementation of

`CatalogReader.tracks`

## Methods

### byRole()

> **byRole**(`role`): (`object` & `object` & `object`)\[]

#### Parameters

##### role

`string`

#### Returns

(`object` & `object` & `object`)\[]

***

### createPad()

> `protected` **createPad**(`direction`, `capabilities`): [`Pad`](../classes/Pad.md)

Creates a pad and emits `padadded`.

#### Parameters

##### direction

`"sink"` | `"src"`

##### capabilities

[`Capabilities`](../type-aliases/Capabilities.md)

#### Returns

[`Pad`](../classes/Pad.md)

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`createPad`](../classes/SourceElement.md#createpad)

***

### destroy()

> **destroy**(): `Promise`<`void`>

Removes the element's pads. The runtime aborts `context.signal` before and releases the
elements this one loaded after. Override for your own cleanup and call `super.destroy()`.

#### Returns

`Promise`<`void`>

#### Overrides

[`SourceElement`](../classes/SourceElement.md).[`destroy`](../classes/SourceElement.md#destroy)

***

### emit()

> **emit**<`K`>(`event`, ...`args`): `void`

Calls every listener of `event` with `args`. Allocates nothing when there are none.

#### Type Parameters

##### K

`K` *extends* `"ready"` | `"padadded"` | `"padremoved"` | `"nomorepads"`

#### Parameters

##### event

`K`

##### args

...`Parameters`<[`ElementEvents`](ElementEvents.md)\[`K`]>

#### Returns

`void`

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`emit`](../classes/SourceElement.md#emit)

***

### find()

> **find**(`name`, `namespace?`): `object` & `object` & `object` | `undefined`

A track by name bytes, in the catalog's namespace unless given (MSF 11.2.2).

#### Parameters

##### name

`string` | `Uint8Array`<`ArrayBufferLike`>

##### namespace?

[`Tuple`](../../model/classes/Tuple.md) = `...`

#### Returns

`object` & `object` & `object` | `undefined`

***

### matchesCapabilities()

> `protected` **matchesCapabilities**(`pad`): `boolean`

True if the pad matches one of the definition's `in` capability bundles.

#### Parameters

##### pad

[`Pad`](../classes/Pad.md)

#### Returns

`boolean`

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`matchesCapabilities`](../classes/SourceElement.md#matchescapabilities)

***

### negotiate()?

> `optional` **negotiate**(`pad`): `boolean`

Optional: whether to take a source pad of an element this one loaded. A taken pad
connects to a new sink pad here instead of reaching the sinks, and its items arrive
through `receive()`.

#### Parameters

##### pad

[`Pad`](../classes/Pad.md)

#### Returns

`boolean`

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`negotiate`](../classes/SourceElement.md#negotiate)

***

### off()

> **off**<`K`>(`event`, `listener`): `void`

Removes `listener`, the same function given to `on()`, from `event`.

#### Type Parameters

##### K

`K` *extends* `"ready"` | `"padadded"` | `"padremoved"` | `"nomorepads"`

#### Parameters

##### event

`K`

##### listener

[`ElementEvents`](ElementEvents.md)\[`K`]

#### Returns

`void`

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`off`](../classes/SourceElement.md#off)

***

### on()

> **on**<`K`>(`event`, `listener`): `void`

Adds `listener` for `event`. Adding the same function twice has no effect.

#### Type Parameters

##### K

`K` *extends* `"ready"` | `"padadded"` | `"padremoved"` | `"nomorepads"`

#### Parameters

##### event

`K`

##### listener

[`ElementEvents`](ElementEvents.md)\[`K`]

#### Returns

`void`

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`on`](../classes/SourceElement.md#on)

***

### receive()?

> `optional` **receive**(`pad`, `item`): `void` | `Promise`<`void`>

Called once per item on a taken pad; the pad's next item waits for the returned promise.

#### Parameters

##### pad

[`Pad`](../classes/Pad.md)

##### item

[`PadItem`](../type-aliases/PadItem.md)

#### Returns

`void` | `Promise`<`void`>

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`receive`](../classes/SourceElement.md#receive)

***

### references()

> **references**(): (`object` & `object` & `object`)\[]

Tracks referencing other catalogs (MSF 5.6.16); loading one is up to the user.

#### Returns

(`object` & `object` & `object`)\[]

***

### removePad()

> `protected` **removePad**(`pad`, `failed?`): `void`

Removes a pad and emits `padremoved`. Pass `failed` when a failure, not a catalog update, lost it.

#### Parameters

##### pad

[`Pad`](../classes/Pad.md)

##### failed?

`boolean` = `false`

#### Returns

`void`

#### Inherited from

[`SourceElement`](../classes/SourceElement.md).[`removePad`](../classes/SourceElement.md#removepad)

***

### start()

> **start**(): `Promise`<`void`>

Subscribes, waits for the first catalog with tracks or `isComplete`, loads the default
sources, and emits `nomorepads`.

#### Returns

`Promise`<`void`>

#### Throws

PlayerError `CATALOG_TIMEOUT` without a usable catalog in time, `UNSUPPORTED_SOURCE`
for an invalid first catalog or one with nothing playable.

***

### timeline()

> **timeline**(`track`): `Promise`<[`TimelineReader`](TimelineReader.md) | `undefined`>

The track's `template`, which needs no subscription; else the media timeline track whose
`depends` names the track or its render group (MSF 7.2), loaded once and shared; else
undefined. A media timeline that can't be read is a warning, and undefined from then on,
so seeks don't wait for it again.

#### Parameters

##### track

`object` & `object` & `object`

#### Returns

`Promise`<[`TimelineReader`](TimelineReader.md) | `undefined`>

#### Implementation of

`CatalogReader.timeline`
