onAudioPublishStateChanged method

FutureOr<void> onAudioPublishStateChanged(
  1. dynamic streamId,
  2. dynamic streamInfo,
  3. dynamic state,
  4. dynamic reason,
)
override

@detail callback @valid since 3.60. Since version 3.60, this callback replaces onStreamStateChanged for reporting audio publishing state changes. If you have upgraded to SDK version 3.60 or later and are still using this method, please migrate to this callback. @author xuyiling.x10 @brief Callback on audio publishing state change. @param streamId The ID of the stream, used to identify a specific audio stream. @param streamInfo The stream information structure, containing detailed information such as room ID and user ID. See StreamInfo{@link #StreamInfo}. @param state Publish state code. See PublishState{@link #PublishState}. @param reason The reason for the change of the publishing state of the local audio stream. See PublishStateChangeReason{@link #PublishStateChangeReason}. @order 0

Implementation

FutureOr<void> onAudioPublishStateChanged(dynamic streamId,
    dynamic streamInfo, dynamic state, dynamic reason) async {
  if ($instance == null || $instance is! IRTCRoomEventHandler) {
    return;
  }
  return ($instance as IRTCRoomEventHandler).onAudioPublishStateChanged?.call(
      streamId.toString(),
      t_PublishState.android_to_code($p_a.PublishState.values
          .firstWhere((t) => t.$value == state || t.name == state)),
      t_PublishStateChangeReason.android_to_code($p_a
          .PublishStateChangeReason.values
          .firstWhere((t) => t.$value == reason || t.name == reason)));
}