Audio levels
getInputVolume() is how loud the visitor’s microphone is right now, from 0 to 1. It returns 0 when there’s no call. Use it for a simple “you’re being heard” light:
getOutputVolume() is the volume you set with setVolume(), not how loud the agent is right now.)
Draw a visualizer
getInputByteFrequencyData() (the visitor) and getOutputByteFrequencyData() (the agent) return the sound’s frequencies as a Uint8Array, each value from 0 to 255. They return an empty array when there’s no call.
Capture call audio
Capture the agent’s voice, the visitor’s, or both, to record the call or send it to another service as it happens. There are three ways, from simplest to most control. WithonAudioData, the agent’s voice from the start of the call, in opus-webm, every 100 ms:
captureAudio, choosing what and how, from the start of the call:
enableAudioCapture(), at any time during the call, and disableAudioCapture() to stop:
enableAudioCapture() throws if there’s no call yet. If you pass both captureAudio and onAudioData, captureAudio is used.
Capture options
Formats
What comes with each chunk
Recording someone usually needs their agreement. Ask before you capture the visitor’s audio.
Related
During a call
Mute the microphone and set the agent’s volume.
Events
Transcripts and the call’s numbers.