onRoomStateUpdate method
void
onRoomStateUpdate()
Notification of the room connection state changes.
Available since: 1.1.0 Description: This callback is triggered when the connection status of the room changes, and the reason for the change is notified.For versions 2.18.0 and above, it is recommended to use the onRoomStateChanged callback instead of the onRoomStateUpdate callback to monitor room state changes. Use cases: Developers can use this callback to determine the status of the current user in the room. When to trigger:
- The developer will receive this notification when calling the
loginRoom
,logoutRoom
,switchRoom
functions. - This notification may also be received when the network condition of the user's device changes (SDK will automatically log in to the room when disconnected, please refer to
Does ZEGO SDK support a fast reconnection for temporary disconnection
for details](https://docs.zegocloud.com/faq/reconnect?product=ExpressVideo&platform=all). Restrictions: None. Caution: If the connection is being requested for a long time, the general probability is that the user's network is unstable. Related APIs:loginRoom
、logoutRoom
、switchRoom
roomID
Room ID, a string of up to 128 bytes in length.state
Changed room state.errorCode
Error code, For details, please refer to Common Error Codes.extendedData
Extended Information with state updates. When the room login is successful, the key "room_session_id" can be used to obtain the unique RoomSessionID of each audio and video communication, which identifies the continuous communication from the first user in the room to the end of the audio and video communication. It can be used in scenarios such as call quality scoring and call problem diagnosis.
Implementation
void onRoomStateUpdate(
String roomID,
ZegoRoomState state,
int errorCode,
Map<String, dynamic> extendedData,
) {}