onRemoteUserLeaveRoom property

(void Function(String userId, int reason)?) onRemoteUserLeaveRoom
final

A User Exited the Room

As with onRemoteUserEnterRoom, this callback works differently in different scenarios (i.e., TRTCAppScene , which you can specify by setting the second parameter when calling enterRoom).

  • Live Streaming Scenarios (TRTCAppScene.live or TRTCAppScene.voiceChatRoom): The callback is triggered only when an anchor exits the room.

  • Call Scenarios (TRTCAppScene.videoCall or TRTCAppScene.audioCall): In call scenarios, the concept of roles does not apply, and the callback is returned when any user exits the room.

  • Parameters:

    • reason(int):
      • Reason for room exit.
        • 0: the user exited the room voluntarily;
        • 1: the user exited the room due to timeout;
        • 2: the user was removed from the room;
        • 3: the anchor user exited the room due to switching to audience.
    • userId(String):
      • User ID of the remote user.

Implementation

final void Function(String userId, int reason)? onRemoteUserLeaveRoom;