silentAudio method

void silentAudio(
  1. bool isSilent
)

Implementation

void silentAudio(bool isSilent) async {
  final pc = peerConnection;
  if (pc == null) { return; }
  final transceivers = await pc.getTransceivers();
  for (RTCRtpTransceiver transceiver in transceivers) {
    final receiver = transceiver.receiver;
    final track = receiver.track;
    if (track != null && track.kind == "audio") {
      if (isSilent == false && track.enabled == true) {
        // do nothing
      } else {
        if (peerTransmitType == RtcClientTransmitType.uploadOnly && isSilent == false) {
          track.enabled = false;
        }
        track.enabled = !isSilent;
      }
    }
  }
}