setMicrophoneMute static method

void setMicrophoneMute(
  1. bool mute,
  2. MediaStreamTrack track
)

Implementation

static void setMicrophoneMute(bool mute, MediaStreamTrack track) async {
  if (track.kind != 'audio') {
    throw 'The is not an audio track => $track';
  }

  if (!kIsWeb) {
    try {
      await WebRTC.invokeMethod(
        'setMicrophoneMute',
        <String, dynamic>{'trackId': track.id, 'mute': mute},
      );
    } on PlatformException catch (e) {
      throw 'Unable to MediaStreamTrack::setMicrophoneMute: ${e.message}';
    }
  }
  track.enabled = !mute;
}