// Use npmnpm i @tencentcloud/tuiroom-engine-js --save// Use pnpmpnpm i @tencentcloud/tuiroom-engine-js --save// Use yarnyarn add @tencentcloud/tuiroom-engine-js
API | Description |
Listen to the TUIRoomEngine ready event. Note: All methods except TUIRoomEngine.login must be executed after listening to the TUIRoomEngine ready event and the successful execution of the TUIRoomEngine.login method. | |
Log in to TUIRoomEngine | |
Set current user basic information (userName, user profile photo) | |
Get current user basic information (userName, user profile photo) | |
Logout TUIRoomEngine | |
Get TUIRoomEngine instance |
API | Description |
Create Room | |
Enter room | |
Terminate room | |
Exit Room | |
Obtain room information | |
Update room name (only group owner or admin can call the API) | |
Update speech mode (only group owner or admin can call the API). This API is deprecated since version 2.0.0. | |
Update room microphone mode (only group owner or admin can call the API) | |
Update room password (only group owner or admin can call the API) | |
Retrieve the current room user list | |
User's detailed information | |
Set user's custom information. This API needs to be called after entering the room. The host can set their own, admin's, and general user's custom information. The admin can set their own and general user's custom information. General users can only set their own custom information. | |
Set room's custom information. This API can only be called after the anchor enters the room. | |
Retrieve room custom information |
API | Description |
Set the rendering position for the local stream | |
Local camera video stream capture | |
Turn the local camera off | |
Open the local microphone | |
Turn the local microphone off | |
Set the resolution of the local video | |
Set the resolution mode of the local video stream | |
Set the encoding parameters of the local video | |
Set local audio parameters | |
Start screen sharing | |
Stop screen sharing | |
Start pushing local video stream to remote | |
Stop pushing local video stream to remote | |
Stop pushing local audio stream to remote | |
Start pushing local audio stream to remote | |
Set the remote streaming rendering area | |
Start playing remote user video stream | |
Stop playing remote user video stream | |
Stop remote user audio stream | |
Set remote audio playback volume |
API | Description |
Request remote user to open media device | |
Attendee submits an application to the host to turn on the device | |
Turn off remote user media device | |
Cancel request | |
Reply to remote user's request | |
Change user's role | |
Modify user nickname in the room. This API is supported since v2.5.0. | |
Kick user out of room | |
Disable/enable all users' media devices | |
Forbid/allow all users to send messages | |
Forbid/allow specific user to send messages | |
Set user's custom information |
API | Description |
Retrieve seat information | |
Retrieve seat info | |
Release microphone position | |
Move a seat | |
Invite others to the stage (only the room host and admin can call this method) | |
Kick others off the mic (only the room host and admin can call this method) | |
Lock a certain seat status (only the room host and admin can call this method) | |
Retrieve the Microphone Request List. This API is supported since v2.1.0 (only the room host and admin can call this method). |
API | Description |
Send text message. This API is deprecated since v2.0.0. | |
Send custom messages. This API is deprecated since v2.0.0. |
API | Description |
Retrieve the camera list | |
Retrieve the microphone list | |
Retrieve the speaker device list | |
Set the camera to be used | |
Set the microphone to be used | |
Set the speaker to be used | |
Retrieve the camera in use | |
Retrieve the microphone in use | |
Retrieve the speaker in use | |
Start camera test | |
Stop camera test | |
Start mic test | |
Stop mic test |
API | Description |
Get a TRTCCloud instance | |
Get a TIM instance | |
Obtain the device management module (supported from version 2.1.0) | |
Retrieve the meeting list management module (supported from version 2.5.0) | |
Retrieve the live list management module (supported from version 3.0.0) | |
Retrieve the live stream layout management module (supported from version 3.0.0) | |
Retrieve the Live Connection management module (supported from version 3.2.0) | |
Retrieve the live PK management module (supported from version 3.3.0) | |
Retrieve the in-meeting invitation management module (supported from version 2.6.0) |
TUIRoomEngine.once('ready', () => {const roomEngine = new TUIRoomEngine();await TUIRoomEngine.login({sdkAppId: 0, // Fill in your applied sdkAppIduserId: '', // Fill in your service correspondence userIduserSig: '', // Fill in the userSig for server or local computing});await roomEngine.createRoom({roomId: '12345', // Fill in your Room ID. Note that the Room ID must be a string typename: 'Test Room', // Fill in your room name. The default is roomId, with a maximum of 30 bytesroomType: TUIRoomType.kConference, // Set the room type to TUIRoomType.kConference});});
// Log in to TUIRoomEngineawait TUIRoomEngine.login({sdkAppId: 0, // Fill in your applied sdkAppIduserId: '', // Fill in your service correspondence userIduserSig: '', // Fill in the userSig for server or local computing});
Parameter | Type | Description | Default Value | Meaning |
sdkAppId | number | Required | - | In the TRTC console, click Application Management > Create Application. After creating a new application, you can obtain the sdkAppId information from the application information. |
userId | string | Required | - | The uid should have a length limit of 32 bytes and only allow a combination of uppercase and lowercase letters (a-zA-Z), digits (0-9), underscore, and hyphen. |
userSig | string | Required | - | userSig signature Compute userSig see UserSig related. |
tim | TIM | optional | - | If you want to use more capabilities of the Instant Messaging SDK while integrating roomEngine, you can create a tim instance and import it into TUIRoomEngine. For tim instance creation, see TIM.create. |
// Set current user userName and user profile photoawait TUIRoomEngine.setSelfInfo({userName: '', // Fill in your new usernameavatarUrl: '', // Fill in your new profile photo url});// Set current user userName, user profile photo and user-customized messageawait TUIRoomEngine.setSelfInfo({userName: '', // Fill in your new usernameavatarUrl: '', // Fill in your new profile photo urlcustomInfo: { // Fill in user custom infoTag_Profile_Custom_Test: 'value1',Tag_Profile_Custom_profile: 'value2',},})
Parameter | Type | Description | Default Value | Meaning |
userName | string | Required | - | Username |
avatarUrl | string | Required | - | user profile photo |
customInfo | object | Optional | - | user-defined profile, supported since v1.3.0 |
// Get current user userName and user profile photoconst loginUserInfo = await TUIRoomEngine.getSelfInfo();
// Logout TUIRoomEngineawait TUIRoomEngine.logout();
const roomEngine = TUIRoomEngine.getInstance();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.createRoom({roomId: '12345', // Fill in your Room ID. Note that the Room ID must be a string typeroomName: 'Test Room', // Fill in your room name. The default is roomId, with a maximum of 30 bytesroomType: TUIRoomType.kConference, // Set the room type to TUIRoomType.kConferenceisSeatEnabled: false, // Set whether microphone position control is enabledisMicrophoneDisableForAllUser: false, // Set whether to allow joining users to turn on microphoneisCameraDisableForAllUser: false, // Set whether to allow joining users to turn on the cameraisMessageDisableForAllUser: false, // Set whether to allow joining users to send messages});
Parameter | Type | Description | Default Value | Meaning |
roomId | string | Required | - | Room ID, roomId has a length limit of 64 bytes and only supports the following character set: uppercase and lowercase English letters (a-zA-Z) Digits (0-9) space ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ , |
roomName | string | Optional | roomId | Room name, default value roomId, does not allow input of empty string |
roomType | Optional | TUIRoomType.kConference | room type office collaboration, medical consultation, remote conference, education scenarios, roomType is set to TUIRoomType.kConference ecommerce live stream, voice chat room scenario, roomType is set to TUIRoomType.kLive | |
isSeatEnabled | boolean | Optional | false | Whether microphone position control is enabled, disabled by default |
seatMode | Optional | TUISeatMode.kFreeToTake | Mic on mode (takes effect after microphone position control is enabled), default value: TUISeatMode.kFreeToTake Free speaking mode. The audience can join the podium freely without applying. seatMode is set to TUISeatMode.kFreeToTake. Apply for microphone mode. Audience must obtain approval from the room owner or admin before joining the podium. seatMode is set to TUISeatMode.kApplyToTake. | |
isMicrophoneDisableForAllUser | boolean | Optional | false | Whether to mute all is enabled, disabled by default |
isScreenShareDisableForAllUser | boolean | Optional | false | Whether to prohibit screen sharing is enabled, disabled by default (supported since v2.3.0) |
isCameraDisableForAllUser | boolean | Optional | false | Whether to disable camera for all is enabled, disabled by default |
isMessageDisableForAllUser | boolean | Optional | false | Whether members are allowed to send messages, allowed by default |
maxSeatCount | number | Optional | - | Maximum number of microphones When roomType is TUIRoomType.kConference (education and conference scenarios), maxSeatCount has no restrictions. When roomType is TUIRoomType.kLivingRoom (live-streaming scenarios), the maximum limit for maxSeatCount is 16. |
password | string | Optional | '' | room password (supported since v2.5.0) |
const roomEngine = TUIRoomEngine.getInstance();const roomInfo = await roomEngine.enterRoom({roomId: '12345',roomType: TUIRoomType.kConference});
Parameter | Type | Description | Default Value | Meaning |
roomId | string | Required | - | room number |
roomType | Optional | TUIRoomType.kConference | room type (supported since v2.3.0) | |
options | object | Optional | - | Optional parameters for entering a room (supported since v2.5.0) |
options.password | string | Optional | - | Room password |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.destroyRoom();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.exitRoom();
const roomEngine = TUIRoomEngine.getInstance();const roomInfo = roomEngine.fetchRoomInfo();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.createRoom({ roomId: '12345' });await roomEngine.updateRoomNameByAdmin({ roomName: 'new name' });
Parameter | Type | Description | Default Value | Meaning |
roomName | string | Required | - | Update the room name, roomName must not be an empty string |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.createRoom({ roomId: '12345' });await roomEngine.updateRoomSpeechModeByAdmin({speechMode: TUISpeechMode.kSpeakAfterTakingSeat // Update to speech mode after taking seat});
Parameter | Type | Description | Default Value | Meaning |
speechMode | Required | - | Update room speech mode |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.createRoom({ roomId: '12345' });await roomEngine.updateRoomSeatModeByAdmin({seatMode: TUISeatMode.kApplyToTake, // Update to apply for microphone mode});
Parameter | Type | Description | Default Value | Meaning |
seatMode | Required | - | type of seat |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.createRoom({ roomId: '12345', password: '123' });await roomEngine.updateRoomPasswordByAdmin({password: '1234', // Update password to 1234});
Parameter | Type | Description | Default Value | Meaning |
password | string | Required | - | Room password |
const roomEngine = TUIRoomEngine.getInstance();const userList = [];let result;let nextSequence = 0;do {result = await roomEngine.getUserList({ nextSequence });userList.push(...result.userInfoList);nextSequence = result.nextSequence;} while (result.nextSequence !== 0)
Parameter | Type | Description | Default Value | Meaning |
nextSequence | number | Optional | 0 | Offset. The default starts from 0 when fetching users. |
const roomEngine = TUIRoomEngine.getInstance();const userList = [];const userInfo = await roomEngine.getUserInfo({userId: 'user_12345',});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | Get user's detailed information by userId |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.setRoomMetadataByAdmin({metadata: JSON.stringify({key1: "value1", key2: "value2"}), // value can only be string});
Parameter | Type | Description | Default Value | Description |
options | object | Required | - | Set room metadata |
options.metadata | string | Required | - | Custom Information |
const roomEngine = TUIRoomEngine.getInstance();const result = await roomEngine.getRoomMetadata({keys: ["key1", "key2"]});
Parameter | Type | Description | Default Value | Description |
options | object | Required | - | Retrieve room metadata |
options.metadata | Array<string> | Required | - | Array of custom information keys |
const roomEngine = TUIRoomEngine.getInstance();// Set the playback area of the local camera stream to the div element with id 'preview-camera'await roomEngine.setLocalVideoView({view: 'preview-camera',});
Parameter | Type | Description | Default Value | Meaning |
view | string | Required | - | id of the div element for stream rendering corresponding to streamType |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.setLocalVideoView({streamType: TUIVideoStreamType.kCameraStream,view: 'preview-camera',});// case 1: turn on the camera on PCawait roomEngine.openLocalCamera();// case 2: turn on the camera on mobile terminal for video previewawait roomEngine.openLocalCamera({ isFrontCamera: true });// case 3: turn on the rear-facing camera on mobile terminal for video previewawait roomEngine.openLocalCamera({ isFrontCamera: false });
Parameter | Type | Description | Default Value | Meaning |
isFrontCamera | boolean | Optional | - | Set the default camera for local video preview on mobile terminal, this parameter only applies to mobile terminal This parameter is supported since v1.3.1. |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.closeLocalCamera();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.openLocalMicrophone();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.closeLocalMicrophone();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.updateVideoQuality({quality: TUIVideoQuality.kVideoQuality_540p,});
Parameter | Type | Description | Default Value | Meaning |
quality | Required | - | Clear TUIVideoProfile.kVideoQuality_360P Standard TUIVideoProfile.kVideoQuality_540P High-definition TUIVideoProfile.kVideoQuality_720P Ultra HD TUIVideoProfile.kVideoQuality_1080P |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.setVideoResolutionMode({type: TUIVideoStreamType.kCameraStream,resolutionMode: TUIResolutionMode.kResolutionMode_Landscape,});
Parameter | Type | Description | Default Value | Meaning |
streamType | Required | - | Local stream type | |
resolutionMode | Required | TUIResolutionMode.kResolutionMode_Landscape | Resolution mode |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.updateVideoQualityEx({streamType: TUIVideoStreamType.kCameraStream,encoderParams: {videoResolution: TUIVideoQuality.kVideoQuality_720p,fps: 15,bitrate: 2000,resolutionMode: TUIResolutionMode.kResolutionMode_Landscape,}});
Parameter | Type | Description | Default Value | Meaning |
streamType | Required | - | Local stream type | |
encoderParams | Required | - | Encoding parameters |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.updateAudioQuality({quality: TUIAudioQuality.kAudioProfileMusic,});
Parameter | Type | Description | Default Value | Meaning |
audioProfile | Required | - | TUIAudioQuality.kAudioProfileSpeech: language mode; sampling rate: 16k TUIAudioQuality.kAudioProfileDefault: standard mode (or default mode); sampling rate: 48k TUIAudioQuality.kAudioProfileMusic: music mode; sampling rate: 48k |
const roomEngine = TUIRoomEngine.getInstance();// example 1: Start screen sharingawait roomEngine.startScreenSharing();// example 2: Start screen sharing (with system audio collection)await roomEngine.startScreenSharing({ screenAudio: true });Start screen sharing and preview locallyawait roomEngine.startScreenSharing({ view: 'screen-preview' });
Parameter | Type | Description | Default Value | Meaning |
screenAudio | boolean | Optional | false | Is sharing system audio optional for web screen sharing? The default value of screenAudio is false. |
view | string | Optional | - | The id of the DOM element for local preview screen sharing. This parameter is supported since v1.6.1. |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.stopScreenSharing();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.startPushLocalVideo();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.stopPushLocalVideo();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.startPushLocalAudio();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.stopPushLocalAudio();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.muteLocalAudio();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.unmuteLocalAudio();
const roomEngine = TUIRoomEngine.getInstance();// Set the remote user video stream to play in the area with id 'remote_preview_camera'await roomEngine.setRemoteVideoView({userId: 'user_1234',streamType: TUIVideoStreamType.kCameraStream,view: 'remote_preview_camera',});// Set the remote user screen sharing stream to play in the area with id 'remote_preview_screen'await roomEngine.setRemoteVideoView({userId: 'user_1234',streamType: TUIVideoStreamType.kScreenStream,view: 'remote_preview_screen',});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
streamType | Required | - | User stream type | |
view | string | Required | - | ID of the div element for remote user stream playback |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.startPlayRemoteVideo({userId: 'user_1234',streamType: TUIVideoStreamType.kCameraStream,});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
streamType | Required | - | User stream type TUIVideoStreamType.kCameraStream video stream TUIVideoStreamType.kScreenStream screen sharing stream TUIVideoStreamType.kCameraStreamLow low-quality video stream |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.stopPlayRemoteVideo({userId: 'user_1234',streamType: TUIVideoStreamType.kCameraStream,});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
streamType | Required | - | User stream type TUIVideoStreamType.kCameraStream video stream TUIVideoStreamType.kScreenStream screen sharing stream TUIVideoStreamType.kCameraStreamLow low-quality video stream |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.muteRemoteAudioStream({userId: 'user_1234',isMute: true,});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
isMute | boolean | Required | - | Whether to stop remote user audio |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.setAudioPlayoutVolume({volume: 100,});
Parameter | Type | Description | Default Value | Meaning |
volume | number | Required | - | Remote audio playback volume, value ranges from 0 to 150 |
const roomEngine = TUIRoomEngine.getInstance();const requestId = roomEngine.openRemoteDeviceByAdmin({userId: 'user_1234',device: TUIMediaDevice.kMicrophone //Request to the device as microphonetimeout: 0,requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {switch (requestCallbackType) {case TUIRequestCallbackType.kRequestAccepted:// Request acceptedbreak;case TUIRequestCallbackType.kRequestRejected:// Request rejectedbreak;case TUIRequestCallbackType.kRequestCancelled:// Request canceledbreak;case TUIRequestCallbackType.kRequestTimeout:// Request timeoutbreak;case TUIRequestCallbackType.kRequestError:// Request errorbreak;default:break;}},});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
device | Required | - | Media device type (camera/microphone/screen sharing) | |
timeout | number | Required | - | Timeout period. If timeout is set to 0, there is no timeout. |
requestCallback | Function | Optional | empty function | Request callback, used to notify the initiator of request acceptance/rejection/cancellation/timeout/error callback |
const roomEngine = TUIRoomEngine.getInstance();const requestId = roomEngine.applyToAdminToOpenLocalDevice({device: TUIMediaDevice.kMicrophone //Request to the device as microphonetimeout: 0,requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {switch (requestCallbackType) {case TUIRequestCallbackType.kRequestAccepted:// Request acceptedbreak;case TUIRequestCallbackType.kRequestRejected:// Request rejectedbreak;case TUIRequestCallbackType.kRequestCancelled:// Request canceledbreak;case TUIRequestCallbackType.kRequestTimeout:// Request timeoutbreak;case TUIRequestCallbackType.kRequestError:// Request errorbreak;default:break;}},});
Parameter | Type | Description | Default Value | Meaning |
device | Required | - | Media device type (camera/microphone/screen sharing) | |
timeout | number | Required | - | Timeout period. If timeout is set to 0, there is no timeout. |
requestCallback | Function | Optional | empty function | Request callback, used to notify the initiator of request acceptance/rejection/cancellation/timeout/error callback |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.closeRemoteDeviceByAdmin({userId: 'user_1234',device: TUIMediaDevice.kMicrophone, //Turn off the microphone});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
device | Required | - | Media device type (camera/microphone/screen sharing) |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.cancelRequest({requestId: '', // please use actual requestId});
Parameter | Type | Description | Default Value | Meaning |
requestId | string | Required | - | Request ID. |
const roomEngine = TUIRoomEngine.getInstance();// Grant the remote requestawait roomEngine.responseRemoteRequest({requestId: '', // please use actual requestIdagree: true,});// Deny the remote requestawait roomEngine.responseRemoteRequest({requestId: '', // please use actual requestIdagree: false,});
Parameter | Type | Description | Default Value | Meaning |
requestId | string | Required | - | Request ID. |
agree | boolean | Required | - | Whether to agree |
const roomEngine = TUIRoomEngine.getInstance();// Example 1: Forbid all users to turn on microphoneawait roomEngine.disableDeviceForAllUserByAdmin({device: TUIMediaDevice.kMicrophone,isDisable: true,})// Example 2: Allow all users to turn on microphoneawait roomEngine.disableDeviceForAllUserByAdmin({device: TUIMediaDevice.kMicrophone,isDisable: false,})
Parameter | Type | Description | Default Value | Meaning |
device | Required | - | Disabled media device type (camera/microphone/screen sharing) | |
isDisable | boolean | Required | - | Forbidden |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.disableSendingMessageForAllUser({isDisable: true,});
Parameter | Type | Description | Default Value | Meaning |
isDisable | boolean | Required | - | Whether is disabled |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.disableSendingMessageByAdmin({userId: 'user_1234',isDisable: true,});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
isDisable | boolean | Required | - | Whether is disabled |
const roomEngine = TUIRoomEngine.getInstance();// Transfer the room to user user_1234await roomEngine.changeUserRole({userId: 'user_1234',role: TUIRole.kRoomOwner,});// Set user user_1234 as room administratorawait roomEngine.changeUserRole({userId: 'user_1234',userRole: TUIRole.kAdministrator,});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
userRole | Required | - | User Role host TUIRole.kRoomOwner admin TUIRole.kAdministrator ordinary member TUIRole.kGeneralUser |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.changeUserNameCard({userId: 'user_1234',nameCard: 'jack',});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
nameCard | string | Required | - | Users in the room name |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.setCustomInfoForUser({userId: 'user_12345',customInfo: {'key1': 'value1','key2': 'value2',}});
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.kickRemoteUserOutOfRoom({userId: 'user_1234',});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
const roomEngine = TUIRoomEngine.getInstance();const seatList = await roomEngine.getSeatList();
const roomEngine = TUIRoomEngine.getInstance();// Scenario 1: Host/Admin joins the stage// Scenario 2: When roomInfo.roomType is TUIRoomType.kConference// When roomInfo.seatMode is TUISeatMode.kFreeToTake, general users can go on-micawait roomEngine.takeSeat({seatIndex: -1,timeout: 0,});// Scenario: When roomInfo.seatMode is TUISeatMode.kApplyToTake, general users can go on-micconst requestId = await roomEngine.instance?.takeSeat({seatIndex: -1,timeout: 0,requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {switch (requestCallbackType) {case TUIRequestCallbackType.kRequestAccepted:// Request acceptedbreak;case TUIRequestCallbackType.kRequestRejected:// Request rejectedbreak;case TUIRequestCallbackType.kRequestCancelled:// Request canceledbreak;case TUIRequestCallbackType.kRequestTimeout:// Request timeoutbreak;case TUIRequestCallbackType.kRequestError:// Request errorbreak;default:break;}},});
Parameter | Type | Description | Default Value | Meaning |
seatIndex | number | Required | - | Seat index, set to -1 when no serial number is available |
timeout | number | Required | - | Timeout period. If timeout is set to 0, there is no timeout. |
requestCallback | Function | Optional | Empty function | Request callback, used to notify the initiator of request acceptance/rejection/cancellation/timeout/error callback |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.leaveSeat();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.moveToSeat({ targetSeatIndex: 1 });
Parameter | Type | Description | Default Value | Meaning |
targetSeatIndex | number | Required | - | Move to target seat index. You will be on this seat after moving. |
const roomEngine = TUIRoomEngine.getInstance();const requestId = roomEngine.takeUserOnSeatByAdmin({seatIndex: 0,userId: 'user_1234',timeout: 0,requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {switch (requestCallbackType) {case TUIRequestCallbackType.kRequestAccepted:// Request acceptedbreak;case TUIRequestCallbackType.kRequestRejected:// Request rejectedbreak;case TUIRequestCallbackType.kRequestCancelled:// Request canceledbreak;case TUIRequestCallbackType.kRequestTimeout:// Request timeoutbreak;case TUIRequestCallbackType.kRequestError:// Request errorbreak;default:break;}},});
Parameter | Type | Description | Default Value | Meaning |
seatIndex | number | Required | - | Seat index |
userId | string | Required | - | User ID |
timeout | number | Required | - | Timeout period. If set to 0, there is no timeout. |
requestCallback | Function | Optional | Empty function | Request callback, used to notify the initiator of request acceptance/rejection/cancellation/timeout/error callback |
const roomEngine = TUIRoomEngine.getInstance();const requestId = await roomEngine.kickUserOffSeatByAdmin({seatIndex: 0,userId: 'user_1234',});
Parameter | Type | Description | Default Value | Meaning |
seatIndex | number | Required | - | Seat index |
userId | string | Required | - | User ID |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.lockSeatByAdmin({seatIndex: 0,lockParams: {lockSeat: true,lockVideo: true,lockAudio: true,},});
Parameter | Type | Description | Default Value | Meaning |
seatIndex | number | Required | - | Seat index |
lockParams | Required | - | Microphone Mute Parameters |
const roomEngine = TUIRoomEngine.getInstance();const applicationList = await roomEngine.getSeatApplicationList();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.sendTextMessage({messageText: 'hello, everyone',});
Parameter | Type | Description | Default Value | Meaning |
messageText | string | Required | - | Text message content |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.sendCustomMessage({messageText: '{ data:'', description: ''}',});
Parameter | Type | Description | Default Value | Meaning |
messageText | string | Required | - | Custom message content |
const roomEngine = TUIRoomEngine.getInstance();// Switch to front-facing camera on mobile terminalawait roomEngine.switchCamera({ isFrontCamera: true });// Switch to rear-facing camera on mobile terminalawait roomEngine.switchCamera({ isFrontCamera: false });
Parameter | Type | Description | Default Value | Meaning |
isFrontCamera | boolean | Required | - | Whether to switch to front camera |
const roomEngine = TUIRoomEngine.getInstance();const cameraList = await roomEngine.getCameraDevicesList();for (i = 0; i < cameraList.length; i++) {var camera = cameraList[i];console.info("camera deviceName: " + camera.deviceName + " deviceId:" + camera.deviceId);}
const roomEngine = TUIRoomEngine.getInstance();const micList = await roomEngine.getMicDevicesList();for (i = 0; i < micList.length; i++) {var mic = micList[i];console.info("mic deviceName: " + mic.deviceName + " deviceId:" + mic.deviceId);}
const roomEngine = TUIRoomEngine.getInstance();const speakerList = await roomEngine.getSpeakerDevicesList();for (i = 0; i < speakerList.length; i++) {var speaker = speakerList[i];console.info("speaker deviceName: " + speaker.deviceName + " deviceId:" + speaker.deviceId);}
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.setCurrentCameraDevice({ deviceId: '' });
Parameter | Type | Description | Default Value | Meaning |
deviceId | string | Required | - | Device ID obtained from getCameraDevicesList |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.setCurrentMicDevice({ deviceId: '' });
Parameter | Type | Description | Default Value | Meaning |
deviceId | string | Required | - | Device ID obtained from getMicDevicesList |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.setCurrentSpeakerDevice({ deviceId: '' });
Parameter | Type | Description | Default Value | Meaning |
deviceId | string | Required | - | Device ID obtained from getSpeakerDevicesList |
const roomEngine = TUIRoomEngine.getInstance();const currentCameraDevice = roomEngine.getCurrentCameraDevice();
const roomEngine = TUIRoomEngine.getInstance();const currentMicDevice = roomEngine.getCurrentMicDevice();
const roomEngine = TUIRoomEngine.getInstance();const currentSpeakerDevice = roomEngine.getCurrentSpeakerDevice();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.startCameraDeviceTest({ view: 'test-preview' });
Parameter | Type | Description | Default Value | Meaning |
view | string | Required | - | Display the video area for camera test. The passed in view is the ID of the div element hosting the video preview. |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.stopCameraDeviceTest();
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.startMicDeviceTest({interval: 200});
Parameter | Type | Description | Default Value | Meaning |
interval | number | Required | - | Microphone Volume callback time (ms) |
const roomEngine = TUIRoomEngine.getInstance();await roomEngine.stopMicDeviceTest();
const roomEngine = TUIRoomEngine.getInstance();roomEngine.on(event, func);
Parameter | Type | Description | Default Value | Meaning |
event | Required | - | List of TUIRoomEngine Events | |
func | Function | Required | - | Event callback function |
const roomEngine = TUIRoomEngine.getInstance();roomEngine.off(event, func);
Parameter | Type | Description | Default Value | Meaning |
event | Required | - | List of TUIRoomEngine Events | |
func | Function | Required | - | Event callback function |
const roomEngine = TUIRoomEngine.getInstance();const trtcCloud = roomEngine.getTRTCCloud();
const roomEngine = TUIRoomEngine.getInstance();const tim = roomEngine.getTIM();
const roomEngine = TUIRoomEngine.getInstance();const deviceManager = roomEngine.getMediaDeviceManager();
const roomEngine = TUIRoomEngine.getInstance();const conferenceListManager = roomEngine.getConferenceListManager();
const roomEngine = TUIRoomEngine.getInstance();const liveListManager = roomEngine.getLiveListManager();
const roomEngine = TUIRoomEngine.getInstance();const liveLayoutManager = roomEngine.getLiveLayoutManager();
const roomEngine = TUIRoomEngine.getInstance();const liveConnectionManager = roomEngine.getLiveConnectionManager();
const roomEngine = TUIRoomEngine.getInstance();const liveBattleManager = roomEngine.getLiveBattleManager();
const roomEngine = TUIRoomEngine.getInstance();const conferenceInvitationManager = roomEngine.getConferenceInvitationManager();
Feedback