toggleMicMuteState method

Future<HMSException?> toggleMicMuteState()

To switch local peer's audio on/off. This function toggles the current microphone state i.e If it's unmuted it will get muted If it's muted it will get unmuted Refer toggle microphone state guide here.

Implementation

Future<HMSException?> toggleMicMuteState() async {
  bool result =
      await PlatformService.invokeMethod(PlatformMethod.toggleMicMuteState);

  if (result) {
    return null;
  } else {
    return HMSException(
        message: "Microphone mute/unmute failed",
        description: "Cannot toggle microphone status",
        action: "AUDIO",
        isTerminal: false,
        params: {});
  }
}