---
url: https://docs.moqtail.dev/ts/api/player/interfaces/SourceElementDefinition.md
---
# Interface: SourceElementDefinition\<E, P>

## Extends

* [`ElementDefinition`](ElementDefinition.md)<`E`, `P`>

## Type Parameters

### E

`E` *extends* [`SourceElement`](../classes/SourceElement.md) = [`SourceElement`](../classes/SourceElement.md)

### P

`P` *extends* readonly [`InterfaceKey`](../type-aliases/InterfaceKey.md)\[] = readonly [`InterfaceKey`](../type-aliases/InterfaceKey.md)\[]

## Properties

### capabilities

> `readonly` **capabilities**: [`CapabilityBundles`](../type-aliases/CapabilityBundles.md)

#### Inherited from

[`ElementDefinition`](ElementDefinition.md).[`capabilities`](ElementDefinition.md#capabilities)

***

### name

> `readonly` **name**: `string`

#### Inherited from

[`ElementDefinition`](ElementDefinition.md).[`name`](ElementDefinition.md#name)

***

### priority?

> `readonly` `optional` **priority?**: `number`

Ranks the probes that accept a track: lower wins, then the earlier definition. Default selection
also keeps only the lowest of the sets sharing an `altGroup` and `lang`. Default 100.

#### Inherited from

[`ElementDefinition`](ElementDefinition.md).[`priority`](ElementDefinition.md#priority)

***

### provides?

> `readonly` `optional` **provides?**: `P`

The optional interfaces this element implements.

#### Inherited from

[`ElementDefinition`](ElementDefinition.md).[`provides`](ElementDefinition.md#provides)

***

### type

> `readonly` **type**: `"source"`

#### Overrides

[`ElementDefinition`](ElementDefinition.md).[`type`](ElementDefinition.md#type)

## Methods

### init()

> **init**(`context`, `options?`): `Promise`<`E`>

Rejection might mean a browser API or a peer dependency is missing.

#### Parameters

##### context

[`ElementContext`](ElementContext.md)

##### options?

`Record`<`string`, `any`>

#### Returns

`Promise`<`E`>

#### Inherited from

[`ElementDefinition`](ElementDefinition.md).[`init`](ElementDefinition.md#init)

***

### probe()

> **probe**(`identifiers`): `boolean`

Whether this element handles the track.

#### Parameters

##### identifiers

[`Identifiers`](Identifiers.md)

#### Returns

`boolean`

***

### supports()?

> `optional` **supports**(`track`): `boolean` | `Promise`<`boolean`>

Whether this element can handle `track`'s media, asked during selection before any instance exists.
Leaving it out means yes. Called with the track as the pad it would take carries it, so behind a decoder
its packaging is `raw`. Yes answers are kept per role, packaging, codec, MIME type, size, sample rate and
channels for the chain's life.
It isn't part of `negotiate`, which is synchronous, since decoders answer asynchronously and per rendition.

#### Parameters

##### track

[`Identifiers`](Identifiers.md)

#### Returns

`boolean` | `Promise`<`boolean`>

#### Inherited from

[`ElementDefinition`](ElementDefinition.md).[`supports`](ElementDefinition.md#supports)

***

### threads()?

> `optional` **threads**(`environment`): `"worker"` | `"main"` | `"both"`

Where the element's engines may run, asked before each instance's `init`. `both` or `worker` give
it `context.worker` while the player has one, and `worker` without one rejects. Default `main`.

#### Parameters

##### environment

###### worker?

{ `has`(`name`): `boolean`; }

The player's worker, absent without one. `has` answers from the worker's own report: its
global names, and `element:<name>` for each engine it serves.

###### worker.has

(`name`) => `boolean`

#### Returns

`"worker"` | `"main"` | `"both"`

#### Inherited from

[`ElementDefinition`](ElementDefinition.md).[`threads`](ElementDefinition.md#threads)
