Prerequisites
- An active call session
- Access to the
CallSessioninstance
Get CallSession Instance
All audio control methods are called on theCallSession singleton:
CallSession.getInstance() returns null if no active session exists. Always use the null-aware ?. operator when calling methods.Mute Audio
Mute the local microphone. Other participants will no longer hear you.When you mute your audio, the
onAudioMuted() callback is triggered on your MediaEventsListener.Unmute Audio
Unmute the local microphone to resume transmitting audio.When you unmute your audio, the
onAudioUnMuted() callback is triggered on your MediaEventsListener.Toggle Mute Audio
Convenience method that toggles between muted and unmuted audio. It checks the current state and calls the appropriate action automatically.Set Audio Mode
Change the audio output device during a call. This allows users to switch between speaker, earpiece, or Bluetooth.AudioMode Enum
| Value | Description |
|---|---|
AudioMode.speaker | Route audio through the device speaker |
AudioMode.earpiece | Route audio through the phone earpiece |
AudioMode.bluetooth | Route audio through a connected Bluetooth device |
When the audio mode changes, the
onAudioModeChanged(AudioMode) callback is triggered on your MediaEventsListener.Check Audio Mute State
Use theisAudioMuted state getter to check whether the local microphone is currently muted.
| Return Type | Description |
|---|---|
bool? | true if audio is muted, false otherwise, null if no active session |
Listen for Audio Events
Register aMediaEventsListener to receive callbacks when audio state changes:
Flutter listeners are not lifecycle-aware. You must manually remove listeners in your widget’s
dispose() method to prevent memory leaks.Initial Audio Settings
You can configure the initial audio state when joining a session usingSessionSettings:
Next Steps
Video Controls
Control video during calls
Media Events Listener
Handle all media events