You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(audio): add AudioManager microphone mute mode API (#1124)
## Description
Adds `AudioManager.setMicrophoneMuteMode` / `getMicrophoneMuteMode` with
a LiveKit-owned `MicrophoneMuteMode` enum (`voiceProcessing`, `restart`,
`inputMixer`), mirroring the Swift SDK's
`AudioManager.microphoneMuteMode`.
## Background
On iOS/macOS the AVAudioEngine-based ADM defaults to `voiceProcessing`
muting, which plays the platform's mute/unmute sound effect (see
flutter-webrtc/flutter-webrtc#2098). Apps can select `inputMixer` or
`restart` to mute silently.
```dart
await AudioManager.instance.setMicrophoneMuteMode(MicrophoneMuteMode.inputMixer);
```
The mode applies to LiveKit's own mute path: disabling a published local
audio track drives the engine-level microphone mute in webrtc
(`WebRtcVoiceSendChannel::MuteStream` -> `adm->SetMicrophoneMute`). For
the fastest silent mute toggling, combine `inputMixer` with
`AudioCaptureOptions(stopAudioCaptureOnMute: false)` (documented on the
API).
## Implementation notes
- Self-contained: implemented on LiveKit's own plugin and method
channel. `LiveKitPlugin.swift` calls the ADM's `muteMode`/`setMuteMode:`
directly (public API in the WebRTC-SDK pod already linked), so this does
not depend on any flutter_webrtc change or release. The companion
flutter-webrtc PR (flutter-webrtc/flutter-webrtc#2105) exposes the same
control to plain flutter-webrtc users independently.
- No flutter_webrtc types on the public surface: the enum is
LiveKit-owned and named to match the Swift SDK (`restart`, not
`restartEngine`).
- No-op on non-Apple platforms, including for `unknown`, so `set(await
get())` round-trips safely in cross-platform code.
- The setter runs off the platform thread natively, since a mode change
while muted can rebuild the audio engine. Setter errors propagate to the
caller (mirrors the Swift SDK's throwing API), the getter falls back to
`unknown`.
- Engine-wide state, recommended to set once before connecting.
## Testing
- `dart analyze lib test` clean, all 315 tests pass.
- iOS example builds against the released flutter_webrtc 1.5.2 pin, no
dependency override needed.
0 commit comments