startNetworkDetection method

Future<int?> startNetworkDetection({
  1. required bool isTestUplink,
  2. required int expectedUplinkBitrate,
  3. required bool isTestDownlink,
  4. required int expectedDownlinkBitrate,
})

@detail api @author hanchenchen.c @brief Enable pre-call network detection @param isTestUplink Whether to detect uplink bandwidth @param expectedUplinkBitrate Expected uplink bandwidth in kbps, unit: kbps
Range: {0, [100-10000]}, 0: Auto, that RTC will set the highest bite rate. @param isTestDownlink Whether to detect downlink bandwidth @param expectedDownlinkBitrate Expected downlink bandwidth in kbps, unit: kbps
Range: {0, [100-10000]}, 0: Auto, that RTC will set the highest bite rate. @return - 0: Success. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details @note - After successfully calling this interface, you will receive onNetworkDetectionResult{@link #IRTCEngineEventHandler#onNetworkDetectionResult} within 3s and every 2s thereafter notifying the probe results; - If the probe stops, you will receive onNetworkDetectionStopped{@link #IRTCEngineEventHandler#onNetworkDetectionStopped} to notify the probe to stop.

Implementation

Future<int?> startNetworkDetection(
    {required bool isTestUplink,
    required int expectedUplinkBitrate,
    required bool isTestDownlink,
    required int expectedDownlinkBitrate}) async {
  $a() => ($instance as $p_a.RTCEngine).startNetworkDetection(isTestUplink,
      expectedUplinkBitrate, isTestDownlink, expectedDownlinkBitrate);
  $i() => ($instance as $p_i.ByteRTCEngine).startNetworkDetection(
      isTestUplink,
      expectedUplinkBitrate,
      isTestDownlink,
      expectedDownlinkBitrate);

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}