toggleAudioEnabled method

Future<void> toggleAudioEnabled(
  1. Participant participant
)

Toggles the provided participant's incoming audio on and off.

Implementation

Future<void> toggleAudioEnabled(Participant participant) async {
  if (participant.member.id == me.id) {
    await toggleAudio();
  } else if (participant.audio.value?.direction.value.isEmitting ?? false) {
    await participant.member.setAudioEnabled(
      !participant.audio.value!.direction.value.isEnabled,
    );
  }
}