Skip to content

const audio: object

Defined in: sdk/js/src/audio.ts:29

The bot’s audio output stream. Errors throw ZaunError.

bufferedMs(): number

The audio written and not yet played, in ms (0 without a stream).

number

clear(): void

Drops everything buffered at once; the stream stays open.

void

close(drain?): void

Closes the stream, after the buffer has played (drain, the default) or at once.

boolean = true

void

open(options): void

Opens the stream, pausing the player. CONFLICT when the bot is in no voice channel or a stream is open; UNSUPPORTED for a format the host cannot take (PCM without an encoder).

AudioStreamOptions

void

writeOpus(packets): number

Opus packets (2.5–120 ms each, ≤ 1000 bytes); returns the ms buffered (BUSY past 3 s).

Uint8Array<ArrayBufferLike>[]

number

writePcm(samples): number

Interleaved samples, any count; returns the ms buffered (BUSY past 3 s).

Int16Array

number