Skip to main content

Room Event Callbacks

Developers can monitor the status and resource changes of remote users in a room by setting different callback methods in RCRTCEngine.

  1. Remote User Join Notification:

    Triggered when a remote user joins the room. Since users can only publish resources after joining, this callback indicates the user has just joined and currently has no published resources, so no media streams from this user can be subscribed to at this point.

    • Parameter roomId: The room ID where the remote user is located.
    • Parameter userId: The remote user ID.
    Function(String roomId, String userId)? onUserJoined;
  2. Remote User Leave Notification:

    Triggered when a remote user leaves the room. The SDK automatically unsubscribes from all streams published by this user, so no manual unsubscribe call is needed.

    • Parameter roomId: The room ID where the remote user was located.
    • Parameter userId: The remote user ID.
    Function(String roomId, String userId)? onUserLeft;
  3. Remote User Offline Notification:

    Triggered when a remote user goes offline, indicating the user has unexpectedly disconnected from RC services for over 1 minute. Poor network conditions, app crashes, or force-closing the app can cause such disconnections. If reconnection fails within 1 minute, the SDK will automatically unsubscribe from all resources of this user, so no manual unsubscribe call is needed.

    • Parameter roomId: The room ID where the remote user was located.
    • Parameter userId: The remote user ID.
    Function(String roomId, String userId)? onUserOffline;
  4. Remote User Resource State Change Notification:

    Triggered when a remote user calls the muteLocalStream method.

    • Parameter roomId: The room ID where the remote user is located.
    • Parameter userId: The remote user ID.
    • Parameter type: The resource type being modified.
    • Parameter disabled: The updated value. true means the resource is muted; false means it's restored.
    Function(String roomId, String userId, RCRTCMediaType type, bool disabled)? onRemoteStateChanged;
  1. Remote User Resource Publish Notification:

    Triggered when a remote user publishes a resource.

    • Parameter roomId: The room ID where the remote user is located.
    • Parameter userId: The remote user ID.
    • Parameter type: The resource type being published.
    Function(String roomId, String userId, RCRTCMediaType type)? onRemotePublished;
  2. Remote User Resource Unpublish Notification:

    Triggered when a remote user unpublishes a resource. The SDK automatically unsubscribes from the corresponding resource. Developers can also provide user feedback based on the resource type.

    • Parameter roomId: The room ID where the remote user is located.
    • Parameter userId: The remote user ID.
    • Parameter type: The resource type being unpublished.
    Function(String roomId, String userId, RCRTCMediaType type)? onRemoteUnpublished;
  3. Live Mix Resource Publish Notification:

    Triggered when the MCU server publishes a resource.

    • Parameter type: The resource type being published.
    Function(RCRTCMediaType type)? onRemoteLiveMixPublished;
  4. Live Mix Resource Unpublish Notification:

    Triggered when the MCU server unpublishes a resource.

    • Parameter type: The resource type being unpublished.
    Function(RCRTCMediaType type)? onRemoteLiveMixUnpublished;

First Frame Callbacks

  1. First Frame Callback for Remote User's Video Resource:

    • Parameter roomId: The room ID where the remote user is located.
    • Parameter userId: The remote user ID.
    • Parameter type: The resource type.
    Function(String roomId, String userId, RCRTCMediaType type)? onRemoteFirstFrame;
  2. First Frame Callback for Live Mix Video Resource:

    • Parameter type: The resource type.
    Function(RCRTCMediaType type)? onRemoteLiveMixFirstFrame;