onPerformanceAlarms method

FutureOr<void> onPerformanceAlarms(
  1. dynamic streamId,
  2. dynamic streamInfo,
  3. dynamic mode,
  4. dynamic reason,
  5. dynamic data,
)
override

@detail callback @author panjian.fishing @brief When the publish performance fallback setPublishFallbackOption{@link #RTCEngine#setPublishFallbackOption} is not turned on locally, and when insufficient device performance is detected, this callback is received.
When the setPublishFallbackOption{@link #RTCEngine#setPublishFallbackOption} is locally turned on, ans when the publish performance fallback/recovery is caused due to device performance/network reasons, this callback is received. @param streamId Stream ID @param streamInfo Stream information, see StreamInfo{@link #StreamInfo}. @param mode Indicates whether the release fallback function is turned on locally. See PerformanceAlarmMode{@link #PerformanceAlarmMode}
- When the publisher does not turn on the release performance fallback, the mode value is NORMAL. - When the publisher turns on the release performance fallback, the mode value is SIMULCAST. @param reason For alarm reasons. See PerformanceAlarmReason{@link #PerformanceAlarmReason} @param data Performance fallback related data. See SourceWantedData{@link #SourceWantedData}.

Implementation

FutureOr<void> onPerformanceAlarms(dynamic streamId, dynamic streamInfo,
    dynamic mode, dynamic reason, dynamic data) async {
  if ($instance == null || $instance is! IRTCEngineEventHandler) {
    return;
  }
  return ($instance as IRTCEngineEventHandler).onPerformanceAlarms?.call(
      streamId.toString(),
      packObject(
          streamInfo,
          () => StreamInfo.fromMap(StreamInfo.deepPackedMapValues(
              StreamInfo.mapMemberToConstructorParams(streamInfo)))),
      t_PerformanceAlarmMode.android_to_code($p_a.PerformanceAlarmMode.values
          .firstWhere((t) => t.$value == mode || t.name == mode)),
      t_PerformanceAlarmReason.android_to_code($p_a
          .PerformanceAlarmReason.values
          .firstWhere((t) => t.$value == reason || t.name == reason)),
      packObject(
          data,
          () => SourceWantedData.fromMap(SourceWantedData.deepPackedMapValues(
              SourceWantedData.mapMemberToConstructorParams(data)))));
}