logoutRoom method

Future<ZegoRoomLogoutResult> logoutRoom(
  1. [String? roomID]
)

Exit the room of the specified room ID with callback.

Available since: 1.1.0 Description: This API will log out the room named roomID. Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc. When to call /Trigger: After successfully logging in to the room, if the room is no longer used, the user can call the function logoutRoom. Restrictions: None. Caution: 1. Exiting the room will stop all publishing and playing streams for user, and inner audio and video engine will stop, and then SDK will auto stop local preview UI. If you want to keep the preview ability when switching rooms, please use the switchRoom method. 2. If the user logs out to the room, but the incoming 'roomID' is different from the logged-in room name, SDK will return failure. Related callbacks: After calling this function, you will receive onRoomStateChanged (Not supported before 2.18.0, please use onRoomStateUpdate) callback notification successfully exits the room, while other users in the same room will receive the onRoomUserUpdate callback notification(On the premise of enabling isUserStatusNotify configuration). Related APIs: Users can use loginRoom, switchRoom functions to log in or switch rooms.

  • roomID Room ID, a string of up to 128 bytes in length. Caution:
    1. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
    2. If you need to communicate with the Web SDK, please do not use '%'.
  • Returns The result of this logout room

Implementation

Future<ZegoRoomLogoutResult> logoutRoom([String? roomID]) async {
  return await ZegoExpressImpl.instance.logoutRoom(roomID);
}