Skip to content

Class: SstsSource ​

The switching set source of the ssts() plugin.

Extends ​

Implements ​

Constructors ​

Constructor ​

new SstsSource(context, options, preferred): SstsSource

preferred is the plugin's list, most preferred first; the source starts on the first negotiated one.

Parameters ​

context ​

ElementContext

options ​

SwitchingSetOptions

preferred ​

readonly bigint[]

Returns ​

SstsSource

Overrides ​

SourceElement.constructor

Properties ​

algorithms ​

readonly algorithms: readonly bigint[]

The negotiated algorithms (sstsAlgorithms), most preferred first, read at init.


context ​

protected readonly context: ElementContext

Inherited from ​

SourceElement.context


definition ​

readonly definition: ElementDefinition

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

Inherited from ​

SourceElement.definition


options ​

readonly options: SwitchingSetOptions


pad ​

readonly pad: Pad


pads ​

readonly pads: Pad[] = []

Inherited from ​

SourceElement.pads

Accessors ​

algorithm ​

Get Signature ​

get algorithm(): bigint

Returns ​

bigint

Methods ​

createPad() ​

protected createPad(direction, capabilities): Pad

Creates a pad and emits padadded.

Parameters ​

direction ​

"sink" | "src"

capabilities ​

Capabilities

Returns ​

Pad

Inherited from ​

SourceElement.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>

Inherited from ​

SourceElement.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[K]>

Returns ​

void

Inherited from ​

SourceElement.emit


getRenditions() ​

getRenditions(): Rendition[]

Returns ​

Rendition[]

Implementation of ​

MediaSourceElement.getRenditions


matchesCapabilities() ​

protected matchesCapabilities(pad): boolean

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

Parameters ​

pad ​

Pad

Returns ​

boolean

Inherited from ​

SourceElement.matchesCapabilities


negotiate() ​

negotiate(): boolean

The chain only offers pads of elements this one loaded: take them all.

Returns ​

boolean

Overrides ​

SourceElement.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[K]

Returns ​

void

Inherited from ​

SourceElement.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[K]

Returns ​

void

Inherited from ​

SourceElement.on


pauseSwitching() ​

pauseSwitching(): Promise<void>

Pauses automatic switching: activate 0 on the set (SSTS 6.2).

Returns ​

Promise<void>


receive() ​

receive(pad, item): Promise<void>

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

Parameters ​

pad ​

Pad

item ​

PadItem

Returns ​

Promise<void>

Overrides ​

SourceElement.receive


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

failed? ​

boolean = false

Returns ​

void

Inherited from ​

SourceElement.removePad


resumeSwitching() ​

resumeSwitching(): Promise<void>

Resumes automatic switching: activate back to the set size.

Returns ​

Promise<void>


selectRenditions() ​

selectRenditions(renditionIds): Promise<void>

Changes the switching set (SSTS 6.2): a deselected track is unsubscribed, a selected one subscribed again. A single selection keeps every track in the set and pins it by threshold.

Parameters ​

renditionIds ​

string[]

Returns ​

Promise<void>

Implementation of ​

MediaSourceElement.selectRenditions


setAlgorithm() ​

setAlgorithm(id): Promise<void>

Moves the whole set to another negotiated algorithm with a REQUEST_UPDATE per subscription; a rejected update rolls the others back, so the set never carries two algorithms. With concurrent calls the latest wins and earlier ones reject with ABORTED.

Parameters ​

id ​

bigint

Returns ​

Promise<void>


setTracks() ​

setTracks(tracks): void

New tracks get a child, selected unless a track is pinned; removed ones are released.

Parameters ​

tracks ​

readonly (object & object & object)[]

Returns ​

void

Implementation of ​

MediaSourceElement.setTracks


start() ​

start(): Promise<void>

Internal

Loads a child per track, in parallel: the publisher activates once all are assigned (SSTS 6.3). The set plays on the children that loaded; it fails only when none did.

Returns ​

Promise<void>


switch() ​

switch(renditionId): Promise<void>

Pins the relay to one track: the same as selecting only it.

Parameters ​

renditionId ​

string

Returns ​

Promise<void>

Implementation of ​

MediaSourceElement.switch