Skip to content

Interface: SourceElementDefinition<E, P> ​

Extends ​

Type Parameters ​

E ​

E extends SourceElement = SourceElement

P ​

P extends readonly InterfaceKey[] = readonly InterfaceKey[]

Properties ​

capabilities ​

readonly capabilities: CapabilityBundles

Inherited from ​

ElementDefinition.capabilities


name ​

readonly name: string

Inherited from ​

ElementDefinition.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.priority


provides? ​

readonly optional provides?: P

The optional interfaces this element implements.

Inherited from ​

ElementDefinition.provides


type ​

readonly type: "source"

Overrides ​

ElementDefinition.type

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>

Inherited from ​

ElementDefinition.init


probe() ​

probe(identifiers): boolean

Whether this element handles the track.

Parameters ​

identifiers ​

Identifiers

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

Returns ​

boolean | Promise<boolean>

Inherited from ​

ElementDefinition.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.threads