rtcRoom$onUserLeave$reason method
@detail callback
@author shenpengliang
@brief This callback is triggered when a remote user is disconnected or turns invisible.
@param rtcRoom ByteRTCRoom object.
@param uid ID of the user who leaves the RTC room, or switches to invisible.
@param reason Reason to leave the room:
- 0: The remote client calls leaveRoom{@link #ByteRTCRoom#leaveRoom} to leave the room.
- 1: The remote client is disconnected because of poor network connection or expired Token.
- 2: The remote client calls setUserVisibility:{@link #ByteRTCRoom#setUserVisibility} to turn invisible.
- 3: The remote user has been removed from the room by the administrator via a OpenAPI call.
Implementation
FutureOr<void> rtcRoom$onUserLeave$reason(
dynamic rtcRoom, dynamic uid, dynamic reason) async {
if ($instance == null || $instance is! IRTCRoomEventHandler) {
return;
}
return ($instance as IRTCRoomEventHandler)
.onUserLeave
?.call(uid.toString(), int.tryParse(reason.toString()) ?? 0);
}