Audio Control
Control audio input and streaming behavior
Audio Input State
By default, the Anam client starts capturing input audio from the user’s microphone when a session starts and stops capturing when the session ends. For certain use cases, you may wish to control the input audio state programmatically.
Getting the Current State
To check the current input audio state:
Mute Audio Input
To mute the input audio:
If you mute the input audio before starting a stream, the session will start with microphone input disabled.
Unmute Audio Input
To unmute the input audio:
Custom Input Streams
If you wish to control the microphone input audio capture yourself, you can pass your own MediaStream
object when starting a stream:
The userProvidedMediaStream
object must be an instance of MediaStream
and the user input audio should be the first audio track returned from the MediaStream.getAudioTracks()
method.
This is the default behavior if you are using navigator.mediaDevices.getUserMedia()
.
Next Steps
Session Configuration
Understand additional configuration options for your Anam sessions
Was this page helpful?