Plays an audio representation of a given message by converting the base64 payload (wav) to an ArrayBuffer and then feeding this ArrayBuffer into the Web Audio API.

To keep it simple this implementation makes the rather naive assumption that all messages that should be played will be added to the queue before playing the first (initial) message is done. This assumption is made to avoid complex Promise heavy code and/or a while loop that may completely block the front-end.

### Hierarchy

- BufferedAudioPlayer

### Implements

- AudioPlayer

## Index

### Properties

- audioContext
- queue
- state
- INSTANCE

### Methods

- play
- playAudio
- instance

## Properties

### Private audioContext

audioContext: AudioContext = new AudioContext()

- Defined in lib/audio/player/BufferedAudioPlayer.ts:27

### Private queue

queue: MutableQueue<any> = new MutableQueue<any>()

- Defined in lib/audio/player/BufferedAudioPlayer.ts:26

### Private state

state: State = State.READY

- Defined in lib/audio/player/BufferedAudioPlayer.ts:28

### Static Private INSTANCE

INSTANCE: BufferedAudioPlayer

- Defined in lib/audio/player/BufferedAudioPlayer.ts:24

## Methods

### play

- play(message: any): void

- Implementation of AudioPlayer.play

  - Defined in lib/audio/player/BufferedAudioPlayer.ts:35

  Adds a message to the Queue and starts playing queued messages.

  #### Parameters

  - ##### message: any

  #### Returns void

### Private playAudio

- playAudio(): void

- - Defined in lib/audio/player/BufferedAudioPlayer.ts:40

  #### Returns void

### Static instance

- instance(): AudioPlayer

- - Defined in lib/audio/player/BufferedAudioPlayer.ts:20

  Singleton to prevent the existence of multiple audio players and therefore overlapping.

  #### Returns AudioPlayer

Generated using TypeDoc