Skip to content

Type Alias: BitrateSelector ​

ts
type BitrateSelector = object;

Defined in: BitrateSelector.ts:21

Beta

A bitrate selection algorithm.

A player creates one selector for each media type. Before every segment request, the player calls select. After every finished or abandoned download, the player calls sample. After a seek or a source change, the player calls reset.

A selector reads the input fields it needs and ignores the rest. A selector that needs an optional field and does not receive it uses a documented default. A selector that keeps a current rung stores its bandwidth, not its index. In each select call, it maps that bandwidth to the highest rung at or below it in the ladder of the call. The bandwidth in sample is authoritative when the player loads a rung other than the decision.

Methods ​

reset() ​

ts
reset(): void;

Defined in: BitrateSelector.ts:45

Returns the selector to its initial state.

Returns ​

void


sample() ​

ts
sample(segment): void;

Defined in: BitrateSelector.ts:40

Records a finished or abandoned download.

Parameters ​

segment ​

SegmentSample

The download. segment.timing is the object the throughput estimator received.

Returns ​

void


select() ​

ts
select(input): BitrateDecision;

Defined in: BitrateSelector.ts:33

Chooses the rung of the next segment.

The player calls this method after the sample of the previous segment and before the next request, not during a download. A second call before the request replaces the first decision. When a decision has a delay, the player waits and then calls this method again. The selector accounts for the wait. A selector may change its state in this call.

Parameters ​

input ​

BitrateSelectorInput

The ladder, the buffer level, and the throughput estimate

Returns ​

BitrateDecision

The position of the chosen rung in input.ladder, and the delay before the next request

A Streaming Video Technology Alliance project.