isLocalOnHold method

Future<bool> isLocalOnHold()

Implementation

Future<bool> isLocalOnHold() async {
  if (state != CallState.kConnected) return false;
  var callOnHold = true;
  // We consider a call to be on hold only if *all* the tracks are on hold
  // (is this the right thing to do?)
  final transceivers = await pc!.getTransceivers();
  for (final transceiver in transceivers) {
    final currentDirection = await transceiver.getCurrentDirection();
    final trackOnHold = (currentDirection == TransceiverDirection.Inactive ||
        currentDirection == TransceiverDirection.RecvOnly);
    if (!trackOnHold) {
      callOnHold = false;
    }
  }
  return callOnHold;
}