Skip to content

AudioInputOptions

Defined in: audio-player.ts:94

Options for AudioPlayer.addInput. Durations are microseconds.

clock?: AudioInputClock;

Defined in: audio-player.ts:99

The broadcast’s playout clock. The input reports the audible timestamp to it about every 20 ms while it plays, and its target latency caps the jitter buffer. Without one, nothing is reported.


decoderConfig?: AudioDecoderConfig;

Defined in: audio-player.ts:101

How to decode. Default: Opus, 48 kHz, two channels; audioDecoderConfigFromTrack reads one from the catalog.


gain?: number;

Defined in: audio-player.ts:103

The input’s gain. Default 1.


jitterTargetUs?: number;

Defined in: audio-player.ts:107

How much audio to hold before playing, at the start and after each underrun. Default 60,000.


maxJitterTargetUs?: number;

Defined in: audio-player.ts:115

The most the target grows to after underruns. Default 400,000, and never more than the clock’s target latency less the output delay and 40 ms: a frame further ahead of the clock than its target latency makes the frame sequencer resync.


minJitterTargetUs?: number;

Defined in: audio-player.ts:109

The least the target shrinks to while playback is smooth. Default 20,000.


playbackRate?: number;

Defined in: audio-player.ts:105

Held audio played per output frame, from 0.5 to 2; see AudioPlayerInput.playbackRate. Default 1.

onCutHeard?(atUs): void;

Defined in: audio-player.ts:123

The latest cut() is heard: called once per cut, with AudioInputStats.cutHeardAtUs, when the jitter buffer’s report says it applied it. A cut that a newer one overtook before it was applied is not reported. An exception from it goes to console.error.

Parameter Type
atUs number

void


onError?(error): void;

Defined in: audio-player.ts:117

A decoder error. The input decodes again from the next frame, with a new decoder.

Parameter Type
error unknown

void