Room Event Callbacks
Developers can monitor the status and resource changes of remote users in a room by setting different callback methods in RCRTCEngine.
Status-Related Callbacks
-
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;
- Parameter
-
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;
- Parameter
-
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;
- Parameter
-
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;
- Parameter
Resource-Related Callbacks
-
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;
- Parameter
-
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;
- Parameter
-
Live Mix Resource Publish Notification:
Triggered when the MCU server publishes a resource.
- Parameter
type
: The resource type being published.
Function(RCRTCMediaType type)? onRemoteLiveMixPublished;
- Parameter
-
Live Mix Resource Unpublish Notification:
Triggered when the MCU server unpublishes a resource.
- Parameter
type
: The resource type being unpublished.
Function(RCRTCMediaType type)? onRemoteLiveMixUnpublished;
- Parameter
First Frame Callbacks
-
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;
- Parameter
-
First Frame Callback for Live Mix Video Resource:
- Parameter
type
: The resource type.
Function(RCRTCMediaType type)? onRemoteLiveMixFirstFrame;
- Parameter