onVideoSubscribeStateChanged method

FutureOr<void> onVideoSubscribeStateChanged(
  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 and onStreamSubscribed for reporting the state changes of the subscription to camera-video streams. If you have upgraded to SDK version 3.60 or later and are still using this two methods, please migrate to this callback. @brief Callback on state changes of the subscription to camera-video streams. @param streamId The ID of the stream, used to identify a specific video stream. @param streamInfo The stream information structure, containing detailed information such as room ID and user ID. See StreamInfo{@link #StreamInfo}. @param state Room state code. See SubscribeState{@link #SubscribeState} for more. @param reason See SubscribeStateChangeReason{@link #SubscribeStateChangeReason} for more. @note You will receive this callback after calling subscribeStreamVideo{@link #RTCRoom#subscribeStreamVideo}.

Implementation

FutureOr<void> onVideoSubscribeStateChanged(dynamic streamId,
    dynamic streamInfo, dynamic state, dynamic reason) async {
  if ($instance == null || $instance is! IRTCRoomEventHandler) {
    return;
  }
  return ($instance as IRTCRoomEventHandler)
      .onVideoSubscribeStateChanged
      ?.call(
          streamId.toString(),
          t_SubscribeState.android_to_code($p_a.SubscribeState.values
              .firstWhere((t) => t.$value == state || t.name == state)),
          t_SubscribeStateChangeReason.android_to_code($p_a
              .SubscribeStateChangeReason.values
              .firstWhere((t) => t.$value == reason || t.name == reason)));
}