switchAudio method

  1. @Deprecated('Use [toggleMicMuteState]')
Future<HMSException?> switchAudio({
  1. bool isOn = false,
})

To switch local peer's audio on/off. Pass the bool value to isOn to change the current audio status

Refer switch audio guide here.

Implementation

@Deprecated('Use [toggleMicMuteState]')
Future<HMSException?> switchAudio({bool isOn = false}) async {
  bool result = await PlatformService.invokeMethod(PlatformMethod.switchAudio,
      arguments: {'is_on': isOn});

  if (result) {
    return null;
  } else {
    return HMSException(
        message: "Switch Audio failed",
        description: "Cannot toggle audio status",
        action: "AUDIO",
        isTerminal: false,
        params: {'is_on': isOn});
  }
}