BaseAudioPlayer class

Base audio player class TODO: Plays only PCM for now.

Constructors

BaseAudioPlayer(AudioStreamFormat)

Creates and initializes an instance of this class.

Methods

playAudioSample(ArrayBuffer, () => void, (error: string) => void)

play Audio sample

stopAudio(() => void, (error: string) => void)

stops audio and clears the buffers

Constructor Details

BaseAudioPlayer(AudioStreamFormat)

Creates and initializes an instance of this class.

new BaseAudioPlayer(audioFormat?: AudioStreamFormat)

Parameters

audioFormat
AudioStreamFormat

audio stream format recognized by the player.

Method Details

playAudioSample(ArrayBuffer, () => void, (error: string) => void)

play Audio sample

function playAudioSample(newAudioData: ArrayBuffer, cb?: () => void, err?: (error: string) => void)

Parameters

newAudioData

ArrayBuffer

audio data to be played.

cb

() => void

err

(error: string) => void

stopAudio(() => void, (error: string) => void)

stops audio and clears the buffers

function stopAudio(cb?: () => void, err?: (error: string) => void)

Parameters

cb

() => void

err

(error: string) => void