Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BufferedAudioPlayer

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

Index

Properties

Private audioContext

audioContext: AudioContext = new AudioContext()

Private queue

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

Private state

state: State = State.READY

Static Private INSTANCE

Methods

play

  • play(message: any): void

Private playAudio

  • playAudio(): void

Static instance

Generated using TypeDoc