onPublisherStateUpdate method

void onPublisherStateUpdate(
  1. String streamID,
  2. ZegoPublisherState state,
  3. int errorCode,
  4. Map<String, dynamic> extendedData,
)

The callback triggered when the state of stream publishing changes.

Available since: 1.1.0 Description: After calling the startPublishingStream successfully, the notification of the publish stream state change can be obtained through the callback function. You can roughly judge the user's uplink network status based on whether the state parameter is in PUBLISH_REQUESTING. Caution: The parameter extendedData is extended information with state updates. If you use ZEGO's CDN content distribution network, after the stream is successfully published, the keys of the content of this parameter are flv_url_list, rtmp_url_list, hls_url_list, these correspond to the publishing stream URLs of the flv, rtmp, and hls protocols. Related callbacks: After calling the startPlayingStream successfully, the notification of the play stream state change can be obtained through the callback function onPlayerStateUpdate. You can roughly judge the user's down-link network status based on whether the state parameter is in PLAY_REQUESTING.

  • streamID Stream ID.
  • state State of publishing stream.
  • errorCode The error code corresponding to the status change of the publish stream, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
  • extendedData Extended information with state updates, include playing stream CDN address.

Implementation

void onPublisherStateUpdate(
  String streamID,
  ZegoPublisherState state,
  int errorCode,
  Map<String, dynamic> extendedData,
) {}