Local User Resources
After joining an RTC room, users need to publish local resources if they want others to see their video or hear their audio. To view others' videos or hear their audio, users need to subscribe to published resources from other participants.
Publish Audio-Video Resources
After successful joinRoom
, developers can use the publish
method in RCRTCEngine
to publish resources captured by the microphone and camera.
-
Sample code:
// Publish audio-video resources (microphone and camera data)
engine.publish(RCRTCMediaType.audio_video);
Unpublish Audio-Video Resources
To stop publishing, call the unpublish
method in RCRTCEngine
to halt sharing microphone and camera resources.
The unpublish method is typically paired with publish. However, if a user exits the room, manual unpublishing isn't required—the SDK automatically handles cancellation when the room exit method is called.
-
Sample code:
// Unpublish audio-video resources (microphone and camera data)
engine.unpublish(RCRTCMediaType.audio_video);