onNetworkDetectionResult method

FutureOr<void> onNetworkDetectionResult(
  1. dynamic type,
  2. dynamic quality,
  3. dynamic rtt,
  4. dynamic lostRate,
  5. dynamic bitrate,
  6. dynamic jitter,
)
override

@detail callback @author hanchenchen.c @brief Pre-call network detection result.
After successfully calling startNetworkDetection{@link #RTCEngine#startNetworkDetection}, you will receive this callback for the first time in 3s and every 2s thereafter. @param type Identifies the network type as uplink/downlink. @param quality Network quality, see NetworkQuality{@link #NetworkQuality}. @param rtt Network RTT in ms. @param lostRate Packet loss rate. @param bitrate Network bandwidth in kbps. @param jitter Network jitter in ms

Implementation

FutureOr<void> onNetworkDetectionResult(dynamic type, dynamic quality,
    dynamic rtt, dynamic lostRate, dynamic bitrate, dynamic jitter) async {
  if ($instance == null || $instance is! IRTCEngineEventHandler) {
    return;
  }
  return ($instance as IRTCEngineEventHandler).onNetworkDetectionResult?.call(
      t_NetworkDetectionLinkType.android_to_code($p_a
          .NetworkDetectionLinkType.values
          .firstWhere((t) => t.$value == type || t.name == type)),
      t_NetworkQuality.android_to_code($p_a.NetworkQuality.values
          .firstWhere((t) => t.$value == quality || t.name == quality)),
      int.tryParse(rtt.toString()) ?? 0,
      double.tryParse(lostRate.toString()) ?? 0,
      int.tryParse(bitrate.toString()) ?? 0,
      int.tryParse(jitter.toString()) ?? 0);
}