TUIRoomEngine
Copyright (c) 2024 Tencent. All rights reserved.
Module: TUIRoomEngine @ TUIKitEngine.
Function: TUIRoomEngine Main function APIs.
Version: 3.2
TUIRoomEngine
TUIRoomEngine
FuncList | DESC |
Create a TUIRoomEngine instance (singleton pattern). | |
Destroy the TUIRoomEngine instance (singleton pattern). | |
After creating a TUIRoomEngine instance, you should login with sdkAppId, userId and userSig then you can call TUIRoomEngine instance and other function. | |
Log out of your account. If you are in the room, there will be active leaving room and destroying resource operations. | |
Update user name and avatar for logged-in user. | |
Return the basic information of the logged-in user, including nickname and avatar. | |
Update user basic information for logged-in user. | |
Set event observer. | |
Remove event observer. | |
Create a room. | |
Dismiss the room. | |
Enter a room. | |
Enter a room. | |
Enter a room. | |
Exit the room. | |
Fetch room information. | |
Fetch room information. | |
Update room name (only support for administrators or room owner). | |
Update room seat mode (only support for administrators or room owner). | |
Update room password. | |
Get room metadata. | |
Set room metadata, if the key already exists, update its value, if not, add the key. | |
Set the local camera to preview the render view. | |
Open the local camera. | |
Close the local camera. | |
Start publishing local video stream, default enabled. | |
Stop publishing local video stream. | |
Update video encoding quality. | |
Set the video encoding parameters. | |
Set the video resolution mode (horizontal resolution or vertical resolution). | |
Set the substitute image for local video during pause. | |
Turn on gravity sensing mode. (only availble on mobile OS and the camera capture scene inside the SDK). | |
Start screen sharing (only available on mobile OS). | |
Stop screen sharing. | |
Open local microphone. | |
Close the local microphone. | |
Update audio encoding quality. | |
Pause publishing the local audio stream. | |
Resume publishing the local audio stream. | |
Enable system audio sharing | |
Set the render view for remote user. | |
Start playing the remote user's video stream. | |
Stop playing the remote user's video stream. | |
Mute the remote user's audio stream. | |
Get the list of user in the room. | |
Get user information. | |
Change user role (only support for administrators or room owner). | |
Change user nickname in the room (only support to change all user for administrators or room owner, user can only change by self). | |
Kick the remote user out of the room (only support for administrators or room owner). | |
Add a tag for the user (only support for administrators or room owner). | |
Remove tag for user (only support for room owner). | |
Get user information in the room based on the tag. | |
Set custom information for room users. | |
The owner or administrator control that all users whether can open device. For example: all users are prohibited from opening the microphone(only available in the conference scenario). | |
Request the remote user to open the media device (only support for administrators or room owner). | |
Close remote user media devices (only support for administrators or room owner). | |
Apply to open the local media device (available to general users). | |
Get seat list. | |
Lock the seat (only support for administrators or room owner). | |
Take the seat. | |
Leave the seat. | |
Move to seat. | |
Invite user to take the seat (only support for administrators or room owner). | |
Kick off the user from seat (only support for administrators or room owner). | |
Get the request list of users who want to take the seat in the room (only support for administrators or room owner). | |
Disable the ability of remote users to send messages (only support for administrators or room owner). | |
Disable the ability of all users to send messages (only support for administrators or room owner). | |
Send text message | |
Send custom message | |
Cancel request. | |
Response request. | |
Get the TRTC instance object. | |
Set the beauty level. | |
Set whitening level. | |
Get the extension. | |
Get device management class. | |
Get live-connection management class. | |
Get live-battle management class. | |
Call experimental APIs. |
sharedInstance
sharedInstance
Create a TUIRoomEngine instance (singleton pattern).
Description:
Creates and returns the global shared instance of TUIRoomEngine (singleton pattern).
Supports both conference and live room types (CONFERENCE & LIVE).
Using singleton pattern avoids duplicate engine instance creation and saves resources.
Return value:
Returns the singleton instance pointer of TUIRoomEngine.
Usage example:
TUIRoomEngine engine = TUIRoomEngine.sharedInstance();
Note
Multiple calls will return the same instance.
destroySharedInstance
destroySharedInstance
Destroy the TUIRoomEngine instance (singleton pattern).
Description:
To avoid unknown exceptions after destroying the singleton instance, this interface is not recommended to be called during program runtime.
Destroys the global shared instance of TUIRoomEngine.
Releases all resources occupied by the engine.
Need to reacquire sharedInstance if used again after calling this.
Usage example:
TUIRoomEngine.destroySharedInstance();
Note
Make sure all rooms have been exited before calling this method.
All engine functionalities will become unavailable after calling this.
Applies to both conference and live room types (CONFERENCE & LIVE) .
login
login
void login | (Context context |
| int sdkAppId |
| String userId |
| String userSig |
| TUIRoomDefine.ActionCallback callback) |
After creating a TUIRoomEngine instance, you should login with sdkAppId, userId and userSig then you can call TUIRoomEngine instance and other function.
Description:
The function supports the CONFERENCE and LIVE room types.
If a user is kicked off while online, the SDK will notify you through the onKickedOffLine callback in TUIRoomObserver.
Usage example:
TUIRoomEngine.login(context, 1400000001, "user123", "xxxxxx",new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Login success handling}@Overridepublic void onError(int errorCode, String errorMessage) {// Login failure handling}});
Parameters:
Param | DESC |
sdkAppId | |
userId | User ID, it is the unique identifier used by Tencent Cloud to distinguish users. |
userSig | The user signature designed by Tencent Cloud based on the UserId, which is used to access Tencent Cloud services. More details, see UserSig. |
Note
You must call this interface to log in successfully before performing other operations.
The userId under the same SDKAppId must be unique.
userSig needs to be generated by your business server.
logout
logout
void logout | (TUIRoomDefine.ActionCallback callback) |
Log out of your account. If you are in the room, there will be active leaving room and destroying resource operations.
Description:
Actively logs out of current login status.
Releases all resources occupied by the engine.
Automatically executes room leaving operation if currently in a room.
Requires calling login interface again for subsequent usage.
Usage Example:
TUIRoomEngine.logout(new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Handle logout success}@Overridepublic void onError(int errorCode, String errorMessage) {// Handle logout failure}});
Parameters:
Param | DESC |
onError | Callback for failed logout, including error code and message. |
onSuccess | Callback for successful logout. |
Note
Ensure all necessary cleanup is completed before calling this method.
All engine functionalities will become unavailable after calling this method.
Applies to both meeting and live room types (CONFERENCE & LIVE).
If logout fails due to network issues, recommend retrying or prompting user to check network.
setSelfInfo
setSelfInfo
void setSelfInfo | (String userName |
| String avatarURL |
| TUIRoomDefine.ActionCallback callback) |
Update user name and avatar for logged-in user.
Description:
Sets local user's nickname and avatar URL.
Modified information will be synchronized to other users in the room.
Applies to both meeting and live room types (TUIRoomTypeConference & TUIRoomTypeLive).
Usage Example:
TUIRoomEngine.setSelfInfo("John", "https://avatar.url",new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Handle success}@Overridepublic void onError(int errorCode, String errorMessage) {// Handle failure}});
Parameters:
Param | DESC |
avatarURL | User avatar URL address. |
onError | Callback for failed operation, including error code and message. |
onSuccess | Callback for successful operation. |
userName | User nickname. |
Note
Avatar URL must be a valid and accessible address.
Nickname and avatar changes may take at least 10 minutes to sync to other users in the room.
getSelfInfo
getSelfInfo
Return the basic information of the logged-in user, including nickname and avatar.
Description:
Retrieves detailed information of currently logged-in user.
Includes basic information like user ID, nickname, avatar URL.
Applies to both meeting and live room types (CONFERENCE & LoginUserInfo).
Return Value:
Returns TUILoginUserInfo object (LoginUserInfo).
Usage Example:
TUIRoomDefine.LoginUserInfo userInfo = TUIRoomEngine.getSelfInfo();
Note
Must be called after successful login, returns locally cached user information.
setSelfInfo
setSelfInfo
void setSelfInfo | |
| TUIRoomDefine.ActionCallback callback) |
Update user basic information for logged-in user.
Description:
Sets basic information of currently logged-in user, including user ID, nickname, avatar URL etc.
Modified information will be synchronized to other users in the room.
Supports both meeting room type and live room type (CONFERENCE & LIVE).
Usage Example:
TUIRoomDefine.LoginUserInfo userInfo = new TUIRoomDefine.LoginUserInfo();userInfo.userId = "user123";userInfo.userName = "John";userInfo.avatarUrl = "https://avatar.url";TUIRoomEngine.setSelfInfo(userInfo, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Handle success}@Overridepublic void onError(int errorCode, String errorMessage) {// Handle logout failure}});
Parameters:
Param | DESC |
callback | Interface callback to notify success or failure of the operation. |
userInfo |
Note
Must be called after successful login.
Avatar URL must be a valid and accessible address.
Nickname and avatar changes may take at least 10 minutes to sync to other users in the room.
addObserver
addObserver
void addObserver |
Set event observer.
Description:
Registers an observer object to receive various event notifications in the room.
Supports both meeting room type and live room type (CONFERENCE & LIVE).
Receives various event notifications through TUIRoomObserver (e.g., error codes, remote user joining, audio/video status parameters, etc.).
Usage Example:
TUIRoomEngine engine = TUIRoomEngine.sharedInstance();engine.addObserver(new TUIRoomObserver() {@Overridepublic void onRemoteUserEnterRoom(String userId) {// Handle user enter room events}@Overridepublic void onRemoteUserLeaveRoom(String userId) {// Handle user exit room events}// Implement other callback methods...});
Parameters:
Param | DESC |
observer | Object instance conforming to TUIRoomObserver protocol. |
Note
Must be called before entering the room.
The added observer object's lifecycle needs to be managed manually.
Avoid adding the same observer repeatedly.
Observer won't be automatically removed after leaving the room, must call removeObserver manually.
removeObserver
removeObserver
void removeObserver |
Remove event observer.
Description:
Unregisters a previously registered observer object to stop receiving various event notifications in the room.
Supports both meeting room type and live room type (CONFERENCE & LIVE).
Usage Example:
class MyRoomObserver implements TUIRoomObserver {@Overridepublic void onRemoteUserEnterRoom(String userId) {// Handle user enter room events}@Overridepublic void onRemoteUserLeaveRoom(String userId) {// Handle user exit room events}// Implement other callback methods...}MyRoomObserver observer = new MyRoomObserver();TUIRoomEngine engine = TUIRoomEngine.sharedInstance();engine.addObserver(observer);// When observation is no longer neededengine.removeObserver(observer);
Parameters:
Param | DESC |
observer | The observer callback instance to be removed. |
Note
Removing non-existent observer may cause errors.
Recommended to call this method before the observer object is destroyed.
createRoom
createRoom
void createRoom | |
| TUIRoomDefine.ActionCallback callback) |
Create a room.
Description:
Creates a new room supporting both conference and live streaming room types (CONFERENCE & LIVE).
Room creator automatically becomes the room owner.
Requires room info parameters to initialize room settings.
Usage Example:
TUIRoomDefine.RoomInfo roomInfo = new TUIRoomDefine.RoomInfo();roomInfo.roomId = "room123";roomInfo.roomType = TUIRoomDefine.RoomType.CONFERENCE;roomInfo.name = "Conference Room";TUIRoomEngine.sharedInstance().createRoom(roomInfo, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {Log.d("TAG", "Room created");}@Overridepublic void onError(TUICommonDefine.Error error, String message) {Log.e("TAG", "Create failed: " + message);}});
Parameters:
Param | DESC |
callback | (Android/Win) Interface callback to notify success or failure of the call, failure callback contains error code and message. |
onError | (iOS) Failure callback (contains error code and message). |
onSuccess | (iOS) Success callback. |
roomInfo | Room information object used to initialize room settings. |
Note
Must call login method first before creating room.
Different room types (CONFERENCE/ LIVE) affect feature availability.
Creator automatically becomes room owner.
Single user can only create one room at a time.
destroyRoom
destroyRoom
void destroyRoom | (TUIRoomDefine.ActionCallback callback) |
Dismiss the room.
Description:
Dismisses the current room where the user is located.
All members will be forcibly removed after room dismissal.
Supports both conference and live room types (CONFERENCE & LIVE).
Usage Example:
TUIRoomEngine.sharedInstance().destroyRoom(new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {Log.d("TAG", "Room dismissed successfully");}@Overridepublic void onError(TUICommonDefine.Error error, String message) {Log.e("TAG", "Failed to dismiss room: " + message);}});
Parameters:
Param | DESC |
callback | (Android/Win) Interface callback to notify success or failure of the call, failure callback contains error code and message. |
onError | (iOS) Failure callback (contains error code and message). |
onSuccess | (iOS) Success callback. |
Note
Only room owner can call this interface.
After room dismissal, SDK will notify users in the room via onRoomDismissed callback in TUIRoomObserver .
Ensure all room transactions are completed before calling this interface.
Dismissed room cannot be recovered, a new room needs to be created for continued use.
enterRoom
enterRoom
void enterRoom | (String roomId |
| TUIRoomDefine.GetRoomInfoCallback callback) |
Enter a room.
Description:
This interface will be deprecated in future versions and is not recommended for use.
For entering rooms, it is recommended to use either:
2.4 enterRoom(String roomId, TUIRoomDefine.RoomType roomType
or 2.5 enterRoom(String roomId, TUIRoomDefine.RoomType roomType, TUIRoomDefine.EnterRoomOptions
interface.Usage Example:
TUIRoomEngine.sharedInstance().enterRoom("room123", new TUIRoomDefine.GetRoomInfoCallback() {@Overridepublic void onSuccess(TUIRoomDefine.RoomInfo roomInfo) {Log.d("TAG", "Enter room successfully");}@Overridepublic void onError(TUICommonDefine.Error error, String message) {Log.e("TAG", "Failed to enter room: " + message);}});
Parameters:
Param | DESC |
callback | (Android/Win) Interface callback to notify success or failure of the call, failure callback contains error code and message. |
onError | (iOS) Failure callback (contains error code and message). |
onSuccess | (iOS) Success callback. |
roomId | Room ID. |
Note
Single device is limited to joining 1 room at the same time. If exceeded, the earliest joined room will be exited automatically.
For same account logged in on multiple devices, only 1 device is allowed to join a conference room with the same ID. Other devices attempting to join will kick out the earlier joined device.
After entering room, SDK will notify users in the room via onRemoteUserEnterRoom callback in TUIRoomObserver.
enterRoom
enterRoom
void enterRoom | (String roomId |
| |
| TUIRoomDefine.GetRoomInfoCallback callback) |
Enter a room.
Description:
Enter the specified room, supporting two room types: conference and live streaming (CONFERENCE & LIVE).
Usage Examples:
TUIRoomEngine.sharedInstance().enterRoom("room123",TUIRoomDefine.RoomType.CONFERENCE,new TUIRoomDefine.GetRoomInfoCallback() {@Overridepublic void onSuccess(TUIRoomDefine.RoomInfo roomInfo) {Log.d("TAG", "Enter room successfully");}@Overridepublic void onError(TUICommonDefine.Error error, String message) {Log.e("TAG", "Failed to enter room: " + message);}});
Parameters:
Param | DESC |
callback | (Android/Win) Interface callback to notify success or failure of the call, failure callback contains error code and message. |
onError | (iOS) Failure callback (contains error code and message). |
onSuccess | (iOS) Success callback. |
roomId | Room ID, must be unique. |
roomType | Room type (conference/live). |
Note
Single device is limited to joining 1 conference room or 3 live rooms simultaneously. If exceeded, the earliest joined room will be exited automatically.
For same account logged in on multiple devices, only 1 device is allowed to join a conference room with the same ID. Other devices attempting to join will kick out the earlier joined device.
After entering room, SDK will notify users in the room via onRemoteUserEnterRoom callback in TUIRoomObserver.
enterRoom
enterRoom
void enterRoom | (String roomId |
| |
| |
| TUIRoomDefine.GetRoomInfoCallback callback) |
Enter a room.
Description:
Enter the specified room, supporting two room types: conference and live streaming (CONFERENCE & LIVE).
Supports passing additional room entry parameters through options, such as room password etc.
Usage Examples:
TUIRoomDefine.EnterRoomOptions options = new TUIRoomDefine.EnterRoomOptions();options.password = "***";TUIRoomEngine.sharedInstance().enterRoom("room123",TUIRoomDefine.RoomType.CONFERENCE,options,new TUIRoomDefine.GetRoomInfoCallback() {@Overridepublic void onSuccess(TUIRoomDefine.RoomInfo roomInfo) {Log.d("TAG", "Enter room successfully");}@Overridepublic void onError(TUICommonDefine.Error error, String message) {Log.e("TAG", "Failed to enter room: " + message);}});
Parameters:
Param | DESC |
callback | (Android/Win) Interface callback to notify success or failure of the call, failure callback contains error code and message. |
onError | (iOS) Failure callback (contains error code and message). |
onSuccess | (iOS) Success callback. |
options | |
roomId | Room ID. |
roomType | Room type. |
Note
Single device is limited to joining 1 conference room or 3 live rooms simultaneously. If exceeded, the earliest joined room will be exited automatically.
For same account logged in on multiple devices, only 1 device is allowed to join a conference room with the same ID. Other devices attempting to join will kick out the earlier joined device.
After entering room, SDK will notify users in the room via onRemoteUserEnterRoom callback in TUIRoomObserver.
exitRoom
exitRoom
void exitRoom | (boolean syncWaiting |
| TUIRoomDefine.ActionCallback callback) |
Exit the room.
Description:
Exit the current room.
This function supports both conference and live streaming room types(CONFERENCE & LIVE).
All audio/video streams will automatically stop pushing after exiting.
Usage Examples:
TUIRoomEngine.sharedInstance().exitRoom(true, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {Log.d("TAG", "Exit room successfully");}@Overridepublic void onError(TUICommonDefine.Error error, String message) {Log.e("TAG", "Failed to exit room: " + message);}});
Parameters:
Param | DESC |
callback | (Android/Win) Interface callback to notify success or failure of the call, failure callback contains error code and message. |
onError | (iOS) Failure callback (contains error code and message). |
onSuccess | (iOS) Success callback. |
syncWaiting | Whether to wait synchronously for the interface to return. |
Note
After leaving the room, the SDK will notify users in the room via onRemoteUserLeaveRoom callback in TUIRoomObserver.
fetchRoomInfo
fetchRoomInfo
void fetchRoomInfo | (TUIRoomDefine.GetRoomInfoCallback callback) |
Fetch room information.
Description:
Get detailed information of the current room, including room ID, room name, room type, etc.
Supports both conference and live streaming room types(CONFERENCE & LIVE).
Usage Examples:
TUIRoomEngine.sharedInstance().fetchRoomInfo(new TUIRoomDefine.GetRoomInfoCallback() {@Overridepublic void onSuccess(TUIRoomDefine.RoomInfo roomInfo) {Log.d("TAG", "Get room info successfully");}@Overridepublic void onError(TUICommonDefine.Error error, String message) {Log.e("TAG", "Failed to get room info: " + message);}});
Parameters:
@param onSuccess(iOS) Callback when room info is successfully obtained, contains $TUIRoomInfo room information.
@param onError(iOS) Failure callback (contains error code and message).
@param callback(Android/Win) Interface callback to notify success or failure of the call, success returns $TUIRoomInfo room info, failure returns error code and message.
Note
:
Must be called after entering a room.
Returned room info includes basic configuration and current status.
Returns error if not currently in any room.
fetchRoomInfo
fetchRoomInfo
void fetchRoomInfo | (String roomId |
| |
| TUIRoomDefine.GetRoomInfoCallback callback) |
Fetch room information.
Param | DESC |
roomId | Room ID. |
roomType |
Note
Return Desc:
Successfully fetched the room information callback, which will include room information of $TUIRoomInfo.
updateRoomNameByAdmin
updateRoomNameByAdmin
void updateRoomNameByAdmin | (String roomName |
| TUIRoomDefine.ActionCallback callback) |
Update room name (only support for administrators or room owner).
Param | DESC |
roomName | Room name. |
Note
After the room name was updated, the SDK notifies users in the room through the onRoomNameChanged callback in TUIRoomObserver.
updateRoomSeatModeByAdmin
updateRoomSeatModeByAdmin
void updateRoomSeatModeByAdmin | |
| TUIRoomDefine.ActionCallback callback) |
Update room seat mode (only support for administrators or room owner).
Param | DESC |
seatMode | TUISeatModeFreeToTake: Free to take seat mode, users can take the seat without application; TUISeatModeApplyToTake: Apply to take seat mode, users can only take the seat after the owner or administrator approved. |
Note
After the room seat mode was updated, the SDK will notify users in the room through the onRoomSeatModeChanged callback in TUIRoomObserver.
updateRoomPasswordByAdmin
updateRoomPasswordByAdmin
void updateRoomPasswordByAdmin | (String password |
| TUIRoomDefine.ActionCallback callback) |
Update room password.
Param | DESC |
password | Room password. |
Note
getRoomMetadata
getRoomMetadata
void getRoomMetadata | (List<String> keys |
| TUIRoomDefine.GetRoomMetadataCallback callback) |
Get room metadata.
Param | DESC |
keys | Room metadata key list, if keys are passed as empty, all metadata will be retrieved. |
Note
setRoomMetadataByAdmin
setRoomMetadataByAdmin
void setRoomMetadataByAdmin | (HashMap<String, String> metadata |
| TUIRoomDefine.ActionCallback callback) |
Set room metadata, if the key already exists, update its value, if not, add the key.
Param | DESC |
metadata | Key-Value in room metadata. |
Note
setLocalVideoView
setLocalVideoView
void setLocalVideoView | (TUIVideoView view) |
Set the local camera to preview the render view.
Param | DESC |
view | Render view. |
Note
openLocalCamera
openLocalCamera
void openLocalCamera | (boolean isFront |
| |
| TUIRoomDefine.ActionCallback callback) |
Open the local camera.
Param | DESC |
isFront | true: front false: rear (only available on mobile OS). |
Note
After opened the local camera in the room, the local video stream is published by default, and the SDK notifies the users in the room through the $onUserVideoStateChanged$ callback in TUIRoomObserver.
closeLocalCamera
closeLocalCamera
Close the local camera.
Note
After closed the local camera in the room, the SDK notifies users in the room through the onUserVideoStateChanged callback in TUIRoomObserver.
startPushLocalVideo
startPushLocalVideo
Start publishing local video stream, default enabled.
Note
After published the local video, if your local camera is opening, the SDK will notify users in the room through the onUserVideoStateChanged callback in TUIRoomObserver.
stopPushLocalVideo
stopPushLocalVideo
Stop publishing local video stream.
Note
After stopped published local video, the SDK notifies users in the room through the onUserVideoStateChanged callback in TUIRoomObserver.
updateVideoQuality
updateVideoQuality
void updateVideoQuality |
Update video encoding quality.
Note
updateVideoQualityEx
updateVideoQualityEx
void updateVideoQualityEx | |
|
Set the video encoding parameters.
Param | DESC |
params | |
streamType |
Note
setVideoResolutionMode
setVideoResolutionMode
void setVideoResolutionMode | |
|
Set the video resolution mode (horizontal resolution or vertical resolution).
Param | DESC |
resolutionMode | |
streamType |
Note
setLocalVideoMuteImage
setLocalVideoMuteImage
void setLocalVideoMuteImage | (Bitmap image) |
Set the substitute image for local video during pause.
Note
Setting the placeholder image is only supported for streaming after calling stopPushLocalVideo; it is not supported after calling closeLocalCamera.@param image Substitute image.
enableGravitySensor
enableGravitySensor
void enableGravitySensor | (boolean enable) |
Turn on gravity sensing mode. (only availble on mobile OS and the camera capture scene inside the SDK).
Param | DESC |
enable | true: Open false: Close. |
Note
After turning on gravity sensing, if the device on the collection end rotates, the images on the collection end and the audience will be rendered accordingly to ensure that the image in the field of view is always facing up.
startScreenSharing
startScreenSharing
Start screen sharing (only available on mobile OS).
Note
After screen sharing started, the SDK notifies users in the room through the onUserVideoStateChanged callback in TUIRoomObserver.
stopScreenSharing
stopScreenSharing
Stop screen sharing.
After screen sharing ended, the SDK notifies users in the room through the onUserVideoStateChanged callback in TUIRoomObserver and also notifies you through the onUserScreenCaptureStopped callback.
openLocalMicrophone
openLocalMicrophone
void openLocalMicrophone | |
| TUIRoomDefine.ActionCallback callback) |
Open local microphone.
Param | DESC |
quality | Audio quality. |
Note
After opened the local microphone in a room, the SDK notifies users in the room through the onUserAudioStateChanged callback in TUIRoomObserver.
closeLocalMicrophone
closeLocalMicrophone
Close the local microphone.
Note
After closed the local microphone in the room, the SDK notifies the users in the room through the onUserAudioStateChanged callback in TUIRoomObserver.
updateAudioQuality
updateAudioQuality
void updateAudioQuality |
Update audio encoding quality.
Note
muteLocalAudio
muteLocalAudio
Pause publishing the local audio stream.
Note
If you have opened your microphone and call the API to pause publishing the local audio stream, the SDK will notify the users in the room through the onUserAudioStateChanged callback in TUIRoomObserver.
unmuteLocalAudio
unmuteLocalAudio
void unmuteLocalAudio | (TUIRoomDefine.ActionCallback callback) |
Resume publishing the local audio stream.
Note
If you have opened your microphone and call the API to resume publishing the local audio stream, the SDK will notify the users in the room through the onUserAudioStateChanged callback in TUIRoomObserver.
enableSystemAudioSharing
enableSystemAudioSharing
void enableSystemAudioSharing | (boolean enable) |
Enable system audio sharing
This API captures system audio data from your device and mixes it into the current audio stream of the SDK. This ensures that other users in the room hear the audio played back by the another app.
Note
Android: You need to use this interface to enable system sound capture first, and it will take effect only when you call startScreenCapture to enable screen sharing.
setRemoteVideoView
setRemoteVideoView
void setRemoteVideoView | (String userId |
| |
| TUIVideoView view) |
Set the render view for remote user.
Param | DESC |
streamType | |
userId | Remote user ID. |
view | Render view. |
Note
startPlayRemoteVideo
startPlayRemoteVideo
void startPlayRemoteVideo | (String userId |
| |
| TUIRoomDefine.PlayCallback callback) |
Start playing the remote user's video stream.
Param | DESC |
streamType | |
userId | User ID. |
Note
stopPlayRemoteVideo
stopPlayRemoteVideo
void stopPlayRemoteVideo | (String userId |
|
Stop playing the remote user's video stream.
Param | DESC |
streamType | |
userId | User ID. |
Note
muteRemoteAudioStream
muteRemoteAudioStream
void muteRemoteAudioStream | (String userId |
| boolean isMute) |
Mute the remote user's audio stream.
Param | DESC |
isMute | true: pause pulling remote user's audio stream, false: resume pulling remote user's audio stream. |
userId | User ID. |
Note
getUserList
getUserList
void getUserList | (long nextSequence |
| TUIRoomDefine.GetUserListCallback callback) |
Get the list of user in the room.
Param | DESC |
nextSequence | Filling in 0 for the first request, if the returned data of the callback is not zero, paging is required, continue the operation until it is 0. |
Note
getUserInfo
getUserInfo
void getUserInfo | (String userId |
| TUIRoomDefine.GetUserInfoCallback callback) |
Get user information.
Param | DESC |
userId | User ID. |
Note
changeUserRole
changeUserRole
void changeUserRole | (String userId |
| |
| TUIRoomDefine.ActionCallback callback) |
Change user role (only support for administrators or room owner).
Param | DESC |
role | |
userId | User ID. |
Note
After the user role changed, the SDK will notify the users in the room through the onUserInfoChanged callback in TUIRoomObserver.
changeUserNameCard
changeUserNameCard
void changeUserNameCard | (String userId |
| String nameCard |
| TUIRoomDefine.ActionCallback callback) |
Change user nickname in the room (only support to change all user for administrators or room owner, user can only change by self).
Param | DESC |
nameCard | User nickname to set, maximum support is 32 bytes |
userId | User ID to change. |
Note
After the user nickname changed, the SDK will notify the users in the room through the onUserInfoChanged callback in TUIRoomObserver.
kickRemoteUserOutOfRoom
kickRemoteUserOutOfRoom
void kickRemoteUserOutOfRoom | (String userId |
| TUIRoomDefine.ActionCallback callback) |
Kick the remote user out of the room (only support for administrators or room owner).
Param | DESC |
userId | User ID. |
Note
After the remote user is kicked off from the room, the SDK notifies the kicked user through the onKickedOutOfRoom callback in TUIRoomObserver and notifies users in the room through onRemoteUserLeaveRoom.
addCategoryTagForUsers
addCategoryTagForUsers
void addCategoryTagForUsers | (int tag |
| List<String> userList |
| TUIRoomDefine.ActionCallback callback) |
Add a tag for the user (only support for administrators or room owner).
Param | DESC |
tag | Integer type, it is recommended that this value must be greater than or equal to 1000, you can customize it. |
userList | User list. |
Note
removeCategoryTagForUsers
removeCategoryTagForUsers
void removeCategoryTagForUsers | (int tag |
| List<String> userList |
| TUIRoomDefine.ActionCallback callback) |
Remove tag for user (only support for room owner).
Param | DESC |
tag | Integer type, it is recommended that this value must be greater than or equal to 1000, you can customize it. |
userList | User list. |
Note
getUserListByTag
getUserListByTag
void getUserListByTag | (int tag |
| long nextSequence |
| TUIRoomDefine.GetUserListCallback callback) |
Get user information in the room based on the tag.
Param | DESC |
nextSequence | Filling in 0 for the first request, if the returned data of the callback is not zero, paging is required, continue the operation until it is 0. |
tag | Integer type, it is recommended that this value must be greater than or equal to 1000, you can customize it. |
Note
setCustomInfoForUser
setCustomInfoForUser
void setCustomInfoForUser | (String userId |
| HashMap<String |
| byte[]> customInfo |
| TUIRoomDefine.ActionCallback callback) |
Set custom information for room users.
Param | DESC |
customInfo | Custom information. |
userId | User userId. |
Note
disableDeviceForAllUserByAdmin
disableDeviceForAllUserByAdmin
void disableDeviceForAllUserByAdmin | |
| boolean isDisable |
| TUIRoomDefine.ActionCallback callback) |
The owner or administrator control that all users whether can open device. For example: all users are prohibited from opening the microphone(only available in the conference scenario).
Param | DESC |
device | |
isDisable | true: disable user to open device, false: enable user to open device. |
Note
After the API call is successful:
If the device type is MICROPHONE , the SDK will notify the users in the room through onAllUserMicrophoneDisableChanged in TUIRoomObserver.
If the device type is CAMERA , the SDK will notify the users in the room through onAllUserCameraDisableChanged in TUIRoomObserver.
If the device type is SCREEN_SHARING , the SDK will notify the users in the room through onScreenShareForAllUserDisableChanged in TUIRoomObserver.
openRemoteDeviceByAdmin
openRemoteDeviceByAdmin
Request openRemoteDeviceByAdmin | (String userId |
| |
| int timeout |
| TUIRoomDefine.RequestCallback callback) |
Request the remote user to open the media device (only support for administrators or room owner).
Param | DESC |
device | |
timeout | Timeout time, in seconds. If it is set to 0, the SDK will not execute timeout detection and will not trigger a timeout callback. |
userId | User ID. |
Note
After calling the API, the SDK will notify the requested user through onRequestReceived in TUIRoomObserver.
Return Desc:
TUIRequest Request body.
closeRemoteDeviceByAdmin
closeRemoteDeviceByAdmin
void closeRemoteDeviceByAdmin | (String userId |
| |
| TUIRoomDefine.ActionCallback callback) |
Close remote user media devices (only support for administrators or room owner).
Param | DESC |
device | |
userId | User ID. |
Note
After the API call is successful:
If the device type is MICROPHONE, the SDK will notify the users in the room through onUserAudioStateChanged in TUIRoomObserver.
If the device type is CAMERA or SCREEN_SHARING, the SDK will notify the users in the room through onUserVideoStateChanged in TUIRoomObserver.
applyToAdminToOpenLocalDevice
applyToAdminToOpenLocalDevice
Request applyToAdminToOpenLocalDevice | |
| int timeout |
| TUIRoomDefine.RequestCallback callback) |
Apply to open the local media device (available to general users).
Param | DESC |
device | |
timeout | Timeout time, in seconds. If it is set to 0, the SDK will not execute timeout detection and will not trigger a timeout callback. |
Note
After the API call is successful, the SDK will notify the requested user through onRequestReceived in TUIRoomObserver.
Return Desc:
TUIRequest: Request body.
getSeatList
getSeatList
void getSeatList | (TUIRoomDefine.GetSeatListCallback callback) |
Get seat list.
Note
lockSeatByAdmin
lockSeatByAdmin
void lockSeatByAdmin | (int seatIndex |
| |
| TUIRoomDefine.ActionCallback callback) |
Lock the seat (only support for administrators or room owner).
Param | DESC |
lockParams | Seat lock parameter. More details, see: $TUISeatLockParam$. |
seatIndex | Seat index. |
Note
If the lockParams is lockSeat, it means that the current seat can not be taken by all users and the user will be kicked off if the seat was taken.
If the lockParams is lockVideo/lockAudio, it means that the current seat can not publish video/audio stream.
takeSeat
takeSeat
Request takeSeat | (int seatIndex |
| int timeout |
| TUIRoomDefine.RequestCallback callback) |
Take the seat.
Param | DESC |
seatIndex | Seat index. If the seat is not enabled or the sequence of seats is not concerned, just fill in -1. |
timeout | Timeout time, in seconds. If it is set to 0, the SDK will not execute timeout detection and will not trigger a timeout callback. |
Note
The user can publish audio/video stream after taking the seat when isSeatEnable is true.
After taking the seat successfully, the SDK will notify the users in the room through $onSeatListChanged$ in TUIRoomObserver.
When the TUISeatMode is ApplyToTake, the operation to take seat need approval from the owner or administrator.
Return Desc:
TUIRequest Request body.
leaveSeat
leaveSeat
void leaveSeat | (TUIRoomDefine.ActionCallback callback) |
Leave the seat.
Note
The user can not publish audio/video stream after leaving the seat when isSeatEnable is true.
After leaving seat successfully, the SDK will notify the users in the room through onSeatListChanged in TUIRoomObserver.
moveToSeat
moveToSeat
void moveToSeat | (int targetSeatIndex |
| TUIRoomDefine.ActionCallback callback) |
Move to seat.
Note
After moving seat successfully, the SDK will notify the users in the room through onSeatListChanged in TUIRoomObserver.
takeUserOnSeatByAdmin
takeUserOnSeatByAdmin
Request takeUserOnSeatByAdmin | (int seatIndex |
| String userId |
| int timeout |
| TUIRoomDefine.RequestCallback callback) |
Invite user to take the seat (only support for administrators or room owner).
Param | DESC |
seatIndex | Seat index. |
timeout | Timeout time, in seconds. If it is set to 0, the SDK will not execute timeout detection and will not trigger a timeout callback. |
userId | User ID. |
Note
After the API call is successful, the SDK will notify the invited user through onRequestReceived in TUIRoomObserver.
Return Desc:
TUIRequest: Request body.
kickUserOffSeatByAdmin
kickUserOffSeatByAdmin
void kickUserOffSeatByAdmin | (int seatIndex |
| String userId |
| TUIRoomDefine.ActionCallback callback) |
Kick off the user from seat (only support for administrators or room owner).
Param | DESC |
seatIndex | Seat index. If the seat is not enabled and the sequence of seats is not concerned, just fill in -1. |
userId | User ID. |
Note
After the API call is successful, the SDK will notify the users in the room through onSeatListChanged in TUIRoomObserver.
getSeatApplicationList
getSeatApplicationList
void getSeatApplicationList | (TUIRoomDefine.RequestListCallback callback) |
Get the request list of users who want to take the seat in the room (only support for administrators or room owner).
Note
disableSendingMessageByAdmin
disableSendingMessageByAdmin
void disableSendingMessageByAdmin | (String userId |
| boolean isDisable |
| TUIRoomDefine.ActionCallback callback) |
Disable the ability of remote users to send messages (only support for administrators or room owner).
Param | DESC |
isDisable | true: disable user to send message, false: enable user to send message. |
userId | User ID. |
Note
After disabling the ability of remote users to send messages, the SDK notifies the disabled user through onSendMessageForUserDisableChanged in TUIRoomObserver.
disableSendingMessageForAllUser
disableSendingMessageForAllUser
void disableSendingMessageForAllUser | (boolean isDisable |
| TUIRoomDefine.ActionCallback callback) |
Disable the ability of all users to send messages (only support for administrators or room owner).
Param | DESC |
isDisable | true: disable all users to send message, false: enable all users to send message. |
Note
After disabling the ability of all users to send messages, the SDK notifies users in the room through onSendMessageForAllUserDisableChanged in TUIRoomObserver.
sendTextMessage
sendTextMessage
void sendTextMessage | |
| TUIRoomDefine.SendTextMessageCallback callback) |
Send text message
Param | DESC |
callback | Callback. |
textMessage | Message object. |
sendCustomMessage
sendCustomMessage
void sendCustomMessage | |
| TUIRoomDefine.SendCustomMessageCallback callback) |
Send custom message
Param | DESC |
callback | Callback. |
customMessage | Message object. |
cancelRequest
cancelRequest
void cancelRequest | (String requestId |
| TUIRoomDefine.ActionCallback callback) |
Cancel request.
Param | DESC |
requestId | Request ID (get from the sent request). |
Note
After cancelling a request, the SDK will notify the requested user through onRequestCancelled in TUIRoomObserver.
The API can be used to cancel a request that has been sent.
responseRemoteRequest
responseRemoteRequest
void responseRemoteRequest | (String requestId |
| boolean agree |
| TUIRoomDefine.ActionCallback callback) |
Response request.
Param | DESC |
agree | YES: Agree the request, NO: Reject the request. |
requestId | Request ID (get from the sent request or notification of the OnRequestReceived event). |
Note
When received a request, you can use this API to reply the received request.
getTRTCCloud
getTRTCCloud
Get the TRTC instance object.
setBeautyLevel
setBeautyLevel
void setBeautyLevel | (int beautyStyle |
| float beautyLevel) |
Set the beauty level.
Param | DESC |
beautyLevel | Beauty level, the value range is 0 - 9; 0 indicates to disable the filter, and 9 indicates the most obvious effect. |
beautyStyle | Beauty style, the values are as follows: 0: Smooth, the skin smoothing effect is more obvious; 1: Natural, the skin smoothing effect is more natural, and more facial details are retained; 2: Excellent, the skin smoothing effect is between smooth and natural, retaining more skin details than smooth, and the skin smoothing degree is higher than natural. |
Note
setWhitenessLevel
setWhitenessLevel
void setWhitenessLevel | (float whitenessLevel) |
Set whitening level.
Param | DESC |
whitenessLevel | Whitening level, ranging from 0 - 9; 0 indicates to disable the filter, and 9 indicates the most obvious effect. |
Note
getExtension
getExtension
Object getExtension |
Get the extension.
Param | DESC |
extensionType |
Note
getMediaDeviceManager
getMediaDeviceManager
Get device management class.
Note
getLiveConnectionManager
getLiveConnectionManager
Get live-connection management class.
Note
getLiveBattleManager
getLiveBattleManager
Get live-battle management class.
Note
callExperimentalAPI
callExperimentalAPI
Object callExperimentalAPI | (String jsonStr |
| TUIRoomDefine.ExperimentalAPIResponseCallback callback) |
Call experimental APIs.
Note