isMicrophoneMuted method

Future<bool> isMicrophoneMuted()

Reads back the audio-device-module microphone mute state.

iOS / macOS only, same rationale as setMicrophoneMuted. Throws UnsupportedError elsewhere.

Note that the native readback cannot distinguish "not muted" from "the ADM could not be queried": both surface as false. Treat a false here as "not known to be muted" rather than proof that capture is live.

Implementation

Future<bool> isMicrophoneMuted() async {
  _checkAdmMuteSupported('isMicrophoneMuted');
  _checkDisposed('isMicrophoneMuted');
  try {
    final response = await WebRTC.invokeMethod(
      'appleAdmIsMicrophoneMuted',
      <String, dynamic>{
        'factoryId': factoryId,
      },
    );
    return response == true;
  } on PlatformException catch (e) {
    throw 'Unable to read microphone muted: ${e.message}';
  }
}