Skip to content

Interface: ElementDefinition<E, P> ​

What the registry stores.

Extended by ​

Type Parameters ​

E ​

E extends BaseElement = BaseElement

P ​

P extends readonly InterfaceKey[] = readonly InterfaceKey[]

Properties ​

capabilities ​

readonly capabilities: CapabilityBundles


name ​

readonly name: string


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.


provides? ​

readonly optional provides?: P

The optional interfaces this element implements.


type ​

readonly type: "source" | "transform" | "sink"

Methods ​

init() ​

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

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

Parameters ​

context ​

ElementContext

options? ​

Record<string, any>

Returns ​

Promise<E>


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

Returns ​

boolean | Promise<boolean>


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"