Remote User Resources
When users join an RTC room, they need to publish local resources if they want others to see their video or hear their audio. To view others' video or hear their audio, users need to subscribe to published resources from remote participants.
Subscribe
Users should subscribe upon receiving the onRemotePublished
callback, which notifies them when a remote user has just published resources. Call the subscribe
method in RCRTCEngine
to subscribe to a remote user's audio/video resources. If the remote user's video resource has enabled simulcast (large/small streams), use the tiny
parameter in subscribe
to choose between the large stream or small stream (default).
-
Parameters:
Parameter Type Description userId String Remote user ID type RCRTCMediaType Resource type tiny bool Whether to subscribe to the small stream optional -
Sample code:
engine.subscribe(userId, RCRTCMediaType.audio_video);
Unsubscribe
To unsubscribe, call the unsubscribe
method in RCRTCEngine
to stop receiving a remote user's audio/video resources. Typically, unsubscribe pairs with subscribe calls. However, if a user intends to leave the room, manually unsubscribing isn't necessary—the SDK handles this automatically during room exit.
-
Parameters:
Parameter Type Description userId String Remote user ID type RCRTCMediaType Resource type -
Sample code:
engine.unsubscribe(userId, RCRTCMediaType.audio_video);