enterRoom abstract method
Enter an audio or video call room (hereinafter referred to as "enter room").
All TRTC users need to enter a room before they can "publish" or "subscribe to" audio/video streams. "Publishing" refers to pushing their own streams to the cloud, and "subscribing to" refers to pulling the streams of other users in the room from the cloud.
After calling this API, you will receive the TRTCCloudListener.onEnterRoom :
If successfully entered the room, result
is a positive number (result
> 0), indicating the time taken to enter the room (in milliseconds).
If entering the room fails, result
is a negative number (result
< 0), indicating the error code for the failure to enter the room.
Parameters:
-
param(TRTCParams):
- Room entry parameter, which is used to specify the user's identity, role, authentication credentials, and other information.
-
scene(TRTCAppScene):
- Application scenario, which is used to specify the use case. The same TRTCAppScene should be configured for all users in the same room.
Note:
-
If the
scene
is selected as TRTCAppScene.live or TRTCAppScene.voiceChatRoom , therole
field inTRTCParams
must be used to specify the role of the current user. -
Regardless of whether entering the room is successful, enterRoom must be paired with exitRoom. Calling enterRoom again before calling exitRoom will result in unexpected errors.
Implementation
void enterRoom(TRTCParams param, TRTCAppScene scene);