Skip to content

feat(audio): add AudioManager microphone mute mode API#1124

Draft
hiroshihorie wants to merge 1 commit into
mainfrom
hiroshi/microphone-mute-mode
Draft

feat(audio): add AudioManager microphone mute mode API#1124
hiroshihorie wants to merge 1 commit into
mainfrom
hiroshi/microphone-mute-mode

Conversation

@hiroshihorie

Copy link
Copy Markdown
Member

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. This is the LiveKit-level counterpart of flutter-webrtc/flutter-webrtc#2105 (see also flutter-webrtc/flutter-webrtc#2098): apps can select inputMixer or restart to mute silently.

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::MuteStreamadm->SetMicrophoneMute). For the fastest silent mute toggling, combine inputMixer with AudioCaptureOptions(stopAudioCaptureOnMute: false) — documented on the API.

API notes

  • No flutter_webrtc types on the public surface: the enum is LiveKit-owned and named to match the Swift SDK (restart, not restartEngine); the mapping to flutter_webrtc happens internally.
  • No-op on non-Apple platforms, including for unknown, so set(await get()) round-trips safely in cross-platform code.
  • Engine-wide state; recommended to set once before connecting.

Dependencies

⚠️ Requires a flutter_webrtc release containing flutter-webrtc/flutter-webrtc#2105. Draft until that ships and the flutter_webrtc pin is bumped here (local development uses a gitignored pubspec_overrides.yaml).

Testing

  • dart analyze lib test clean, all 314 tests pass.

Adds AudioManager.setMicrophoneMuteMode/getMicrophoneMuteMode with a
LiveKit-owned MicrophoneMuteMode enum (voiceProcessing, restart,
inputMixer), mirroring the Swift SDK. Controls how the AVAudioEngine
audio device module mutes mic input on iOS/macOS; no-op elsewhere,
including for unknown, so get/set round-trips are safe cross-platform.
voiceProcessing (the default) plays the platform mute tone, inputMixer
and restart mute silently.

The mode applies to LiveKit's own mute path: disabling a published
local audio track drives the engine-level microphone mute.

Requires flutter_webrtc with microphone mute mode support (see local
pubspec_overrides.yaml until released).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant