// 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 |
Listening to the TUIRoomEngine ready Event. Note: All methods other than TUIRoomEngine.login must be executed after listening to the TUIRoomEngine ready event and the successful execution of the TUIRoomEngine.login method. | |
Login to TUIRoomEngine | |
Setting the current user's Basic information (Username, User Avatar) | |
Get the current user's Basic information (Username, User Avatar) | |
Logout of TUIRoomEngine |
API | Description |
Create Room | |
Enter Room | |
Destroy Room | |
Exit Room | |
Get Room data | |
Update Name (Call by Group Owner or Administrator only) | |
Update Speaking Mode (Call by Group Owner or Administrator only) | |
Get User List | |
Learn more about the user |
API | Description |
Set Local Stream Rendering Position | |
Capturing Local Camera Video streams | |
Close Local Camera | |
Open Local mic | |
Close Local mic | |
Set Local Video Parameters | |
Set Local Audio Parameters | |
Start Screen Sharing | |
Stop Screen Sharing | |
Start Pushing Local Video streams to Remote | |
Stop Pushing Local Video streams to Remote | |
Start Pushing Local Audio Stream to Remote | |
Stop Pushing Local Audio Stream to Remote | |
Set Remote Stream Rendering Area | |
Start Playback Remote User Video streams | |
Stop Playback Remote User Video streams | |
Stop Remote User Audio Stream |
API | Description |
Request Remote User to Open Media Device | |
Participant Apply to Host to Open Device | |
Close Remote User Media Device | |
Cancel Sent Request | |
Reply to Remote User Request | |
Change User Role | |
Kick Out User from Room | |
Disable/Enable All Users' Media Device | |
Disallow/Allow All Users to Send Message | |
Disallow/Allow Specific User to Send Message |
API | Description |
Set Room Maximum Value | |
Get Mic Position Information | |
Get Mic Position | |
Release Mic Position | |
Invite Others to Go Live (Only Room Host and Administrator can invoke this method) | |
Kick Others Off the Mic (Only Room Host and Administrator can invoke this method) | |
Lock a Specific Mic Position Status (Only Room Host and Administrator can invoke this method) |
API | Description |
Send Text Message | |
Send Custom Message |
API | Description |
Get Camera Device List | |
Get Mic Device List | |
Get Speaker Device List | |
Set to Use Camera | |
Set to Use Mic | |
Set to Use Speaker | |
Get the Currently Used Camera | |
Get the Currently Used Mic | |
Get the Currently Used Speaker | |
Start Camera Test | |
Stop Camera Test |
API | Description |
API | Description |
Get trtcCloud Instance | |
Get tim Instance |
TUIRoomEngine.once('ready', () => {const roomEngine = new TUIRoomEngine();await TUIRoomEngine.login({sdkAppId: 0, // Fill in the sdkAppId you applied foruserId: '', // Fill in the userId corresponding to your businessuserSig: '', // Fill in the userSig calculated by the server or locally});await roomEngine.createRoom({roomId: '12345', // Enter your Room ID, note that the Room ID is required to be a string typename: 'Test Room', // Enter your room name, the default room name is roomId, up to 30 bytesroomType: TUIRoomType.kGroup, // Set the room type to TUIRoomType.kGroup type});});
// Login TUIRoomEngineawait TUIRoomEngine.login({sdkAppId: 0, // Fill in the sdkAppId you applied foruserId: '', // Fill in the userId corresponding to your businessuserSig: '', // Fill in the userSig calculated by the server or locally});
Parameter | Type | Description | Default Value | Meaning |
sdkAppId | number | Required | - | After clicking Application Management > Create Application in the Tencent Real-Time Communication Console, you can get the sdkAppId information in Application Info. |
userId | string | Required | - | It is recommended to limit the user ID length to 32 bytes, and only allow uppercase and lowercase English letters (a-zA-Z), numbers (0-9), underscores, and hyphens. |
userSig | string | Required | - | UserSig signature |
tim | TIM | Not Required | - | If you want to use more capabilities of the Chat SDK while accessing roomEngine, you can pass the created tim instance into TUIRoomEngine. For the creation method of tim instance, please refer to TIM.create. |
// Set current user Username and User avatarawait TUIRoomEngine.setSelfInfo({userName: '', // Enter your New usernameavatarUrl: '', // Enter your New avatar URL});
Parameter | Type | Description | Default Value | Meaning |
userName | string | Required | - | User Name |
avatarUrl | string | Required | - | User avatar |
// Get current user Username and User avatarconst loginUserInfo = await TUIRoomEngine.getSelfInfo();
// Logout TUIRoomEngineawait TUIRoomEngine.logout();
const roomEngine = new TUIRoomEngine();await roomEngine.createRoom({roomId: '12345', // Enter your Room ID, note that the Room ID must be a string typeroomName: 'Test Room', // Enter your Room Name, the default Room Name is roomId, with a maximum length of 30 bytesroomType: TUIRoomType.kConference, // Set the Room Type to TUIRoomType.kConferencespeechMode: TUISpeechMode.kFreeToSpeak, // Set the speech mode to free speech modeisMicrophoneDisableForAllUser: false, // Allow users to turn on their mic when joining the roomisCameraDisableForAllUser: false, // Allow users to turn on their Camera when joining the roomisMessageDisableForAllUser: false, // Allow users to send messages when joining the room});
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 sets: English letters (a-zA-Z) Numbers (0-9) Space ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ , |
roomName | string | Optional | roomId | Room Name, default value is roomId, cannot be an empty string |
roomType | Optional | TUIRoomType.kConference | Room Type Office collaboration, medical consultation, remote conference, educational scene, roomType is set to TUIRoomType.kConference E-commerce live broadcast, audio chat room scene, roomType is set to TUIRoomType.kLivingRoom | |
speechMode | Optional | TUISpeechMode.kFreeToSpeak | Speech mode in the room For TUIRoomType.kConference (education and conference scenes): Set speechMode to TUISpeechMode.kFreeToSpeak, users can turn on their Camera and mic by default when entering the room Set speechMode to TUISpeechMode.kApplyToSpeak, users do not turn on their Camera and mic by default when entering the room, and need to apply to the host to turn on their Camera or mic. TUISpeechMode.kFreeToSpeak and TUISpeechMode.kApplyToSpeak modes can be switched Set speechMode to TUISpeechMode.kSpeakAfterTakingSeat, users need to call the takeSeat interface to get permission to turn on their Camera and mic after entering the room For TUIRoomType.kLivingRoom (live broadcast scene): Set speechMode to TUISpeechMode.kFreeToSpeak, no need for host approval to Go Live Set speechMode to TUISpeechMode.kSpeakAfterTakingSeat, host approval is required to Go Live TUISpeechMode.kFreeToSpeak and TUISpeechMode.kSpeakAfterTakingSeat modes can be switched | |
isMicrophoneDisableForAllUser | boolean | Optional | false | Enable mute all by default, do not enable mute all by default |
isCameraDisableForAllUser | boolean | Optional | false | Enable disable all drawings by default, do not enable disable all drawings by default |
isMessageDisableForAllUser | boolean | Optional | false | Allow members to send messages, do not prohibit by default |
maxSeatCount | number | Optional | - | Maximum number of microphone seats For TUIRoomType.kConference (education and conference scenes), there is no limit on the value of maxSeatCount For TUIRoomType.kLivingRoom (live broadcast scene), the maximum limit of maxSeatCount is 16 |
enableCDNStreaming | boolean | Optional | false | Enable CDNs live stream |
cdnStreamDomain | string | Optional | '' | Push domain |
const roomEngine = new TUIRoomEngine();const roomInfo = await roomEngine.enterRoom({roomId: '12345',});
Parameter | Type | Description | Default Value | Meaning |
roomId | string | Required | - | Room ID |
const roomEngine = new TUIRoomEngine();await roomEngine.destroyRoom();
const roomEngine = new TUIRoomEngine();await roomEngine.exitRoom();
const roomEngine = new TUIRoomEngine();const roomInfo = roomEngine.fetchRoomInfo();
const roomEngine = new TUIRoomEngine();await roomEngine.createRoom({ roomId: '12345' });await roomEngine.updateRoomNameByAdmin({ roomName: 'NewName' });
Parameter | Type | Description | Default Value | Meaning |
roomName | string | Required | - | Update the room's name, with the requirement that roomName is not an empty string |
const roomEngine = new TUIRoomEngine();await roomEngine.createRoom({ roomId: '12345' });await roomEngine.updateRoomSpeechModeByAdmin({speechMode: TUISpeechMode.kSpeakAfterTakingSeat // Update to Go Live Speaking mode});
Parameter | Type | Description | Default Value | Meaning |
speechMode | TUISpeechMode | Required | - | Update the room's speaking mode |
const roomEngine = new TUIRoomEngine();const userList = [];let result;do {result = await globalProperties.roomEngine.getUserList();userList.push(...result.userInfoList);} while (result.nextSequence !== 0)
Parameter | Type | Description | Default Value | Meaning |
nextSequence | number | Optional | 0 | Offset, default is to start fetching users from 0 |
const roomEngine = new TUIRoomEngine();const userList = [];const userInfo = await roomEngine.getUserInfo({userId: 'user_12345',});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | Get the detailed information of the user according to userId |
const roomEngine = new TUIRoomEngine();// Set the playback area of the local camera stream to the div element with id 'preview-camera'await roomEngine.setLocalVideoView({streamType: TUIVideoStreamType.kCameraStream,view: 'preview-camera',});// Set the playback area of the local screen sharing stream to the div element with id 'preview-screen'await roomEngine.setLocalVideoView({streamType: TUIVideoStreamType.kScreenStream,view: 'preview-screen',});
Parameter | Type | Description | Default Value | Meaning |
streamType | Required | - | Local stream type | |
view | string | Required | - | The id of the div element corresponding to the streamType |
const roomEngine = new TUIRoomEngine();await roomEngine.setLocalVideoView({streamType: TUIVideoStreamType.kCameraStream,view: 'preview-camera',});await roomEngine.openLocalCamera();
const roomEngine = new TUIRoomEngine();await roomEngine.closeLocalCamera();
const roomEngine = new TUIRoomEngine();await roomEngine.openLocalMicrophone();
const roomEngine = new TUIRoomEngine();await roomEngine.closeLocalMicrophone();
const roomEngine = new TUIRoomEngine();await roomEngine.updateVideoQuality({quality: TUIVideoQuality.kVideoQuality_540p,});
Parameter | Type | Description | Default Value | Meaning |
quality | Required | - | Clear TUIVideoProfile.kVideoQuality_360P SD TUIVideoProfile.kVideoQuality_540P HD TUIVideoProfile.kVideoQuality_720P Full HD TUIVideoProfile.kVideoQuality_1080P |
const roomEngine = new TUIRoomEngine();await roomEngine.setLocalAudioProfile({audioProfile: TUIAudioProfile.kAudioProfileSpeech,});
Parameter | Type | Description | Default Value | Meaning |
audioProfile | Required | - | TUIAudioProfile.kAudioProfileSpeech: Speech Mode; Sample rate: 16k TUIAudioProfile.kAudioProfileDefault: Standard Mode (or Default Mode); Sample rate: 48k TUIAudioProfile.kAudioProfileMusic: Music Mode; Sample rate: 48k |
const roomEngine = new TUIRoomEngine();// Set the playback area of the local screen sharing stream to the div element with id 'preview-screen', which can be unsetawait roomEngine.setLocalRenderView({streamType: TUIVideoStreamType.kScreenStream,view: 'preview-screen',});// example 1: Start Screen Sharingawait roomEngine.startScreenSharing();// example 2: Start Screen Sharing(Capturing System Audio)await roomEngine.startScreenSharing({ screenAudio: true });
Parameter | Type | Description | Default Value | Meaning |
screenAudio | boolean | Optional | false | Whether web screen sharing can optionally share system sound, screenAudio default value is false |
const roomEngine = new TUIRoomEngine();await roomEngine.stopScreenSharing();
const roomEngine = new TUIRoomEngine();await roomEngine.startPushLocalVideo();
const roomEngine = new TUIRoomEngine();await roomEngine.stopPushLocalVideo();
const roomEngine = new TUIRoomEngine();await roomEngine.startPushLocalAudio();
const roomEngine = new TUIRoomEngine();await roomEngine.stopPushLocalAudio();
const roomEngine = new TUIRoomEngine();// Set the remote user's 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's 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 | - | The id of the div element playing the remote user's stream |
const roomEngine = new TUIRoomEngine();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 Definition Video Stream |
const roomEngine = new TUIRoomEngine();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 Definition Video Stream |
const roomEngine = new TUIRoomEngine();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's Audio |
const roomEngine = new TUIRoomEngine();const requestId = roomEngine.openRemoteDeviceByAdmin({userId: 'user_1234',device: TUIMediaDevice.kMicrophone //The requested device is a mictimeout: 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 | TUIMediaDevice | Required | - | Media Device Type (Camera/Mic/Screen Sharing) |
timeout | number | Required | - | Timeout Time. If timeout is set to 0, there is no timeout time |
requestCallback | Function | Required | Empty Function | Request Callback, used to notify the initiator of the request being accepted/rejected/canceled/timeout/error |
const roomEngine = new TUIRoomEngine();const requestId = roomEngine.applyToAdminToOpenLocalDevice({device: TUIMediaDevice.kMicrophone //The requested device is a mictimeout: 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 | TUIMediaDevice | Required | - | Media Device Type (Camera/Mic/Screen Sharing) |
timeout | number | Required | - | Timeout Time. If timeout is set to 0, there is no timeout time |
requestCallback | Function | Optional | Empty Function | Request Callback, used to notify the initiator of the request being accepted/rejected/canceled/timeout/error |
const roomEngine = new TUIRoomEngine();await roomEngine.closeRemoteDeviceByAdmin({userId: 'user_1234',device: TUIMediaDevice.kMicrophone, //Close mic});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
device | TUIMediaDevice | Required | - | Media Device Type (Camera/Mic/Screen Sharing) |
const roomEngine = new TUIRoomEngine();await roomEngine.cancelRequest({requestId: '', // Please use Actual requestId});
Parameter | Type | Description | Default Value | Meaning |
requestId | string | Required | - | Request ID |
const roomEngine = new TUIRoomEngine();// Agree to Remote User's Requestawait roomEngine.responseRemoteRequest({requestId: '', // Please use Actual requestIdagree: true,});// Reject Remote User's 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 |
// Example 1: Prohibit All Users to Open Micawait roomEngine.disableDeviceForAllUserByAdmin({device: TUIMediaDevice.kMicrophone,isDisable: true,})// Example 2: Allow All Users to Open Micawait roomEngine.disableDeviceForAllUserByAdmin({device: TUIMediaDevice.kMicrophone,isDisable: false,})
Parameter | Type | Description | Default Value | Meaning |
device | TUIMediaDevice | Required | - | Disabled Media Device Type (Camera/Mic/Screen Sharing) |
isDisable | boolean | Required | - | Whether it is Prohibited |
await roomEngine.disableSendingMessageForAllUser({isDisable: true,});
Parameter | Type | Description | Default Value | Meaning |
isDisable | boolean | Required | - | Whether it is Disabled |
await roomEngine.disableSendingMessageByAdmin({userId: 'user_1234',isDisable: true,});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
isDisable | boolean | Required | - | Whether it is Disabled |
const roomEngine = new TUIRoomEngine();// Transfer the Room to User user_1234await roomEngine.changeUserRole({userId: 'user_1234',role: TUIRole.kRoomOwner,});// Set 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 Administrator TUIRole.kAdministrator General Member TUIRole.kGeneralUser |
const roomEngine = new TUIRoomEngine();await roomEngine.kickRemoteUserOutOfRoom({userId: 'user_1234',});
Parameter | Type | Description | Default Value | Meaning |
userId | string | Required | - | User ID |
const roomEngine = new TUIRoomEngine();await roomEngine.createRoom({ roomId: '12345' });await roomEngine.setMaxSeatCount({ maxSeatCount: 16 })
Parameter | Type | Description | Default Value | Meaning |
maxSeatCount | number | Required | - | Set Room Seat Maximum Value |
const roomEngine = new TUIRoomEngine();const seatList = await roomEngine.getSeatList();
const roomEngine = new TUIRoomEngine();// Scenario 1: Host/Administrator Go Live// Scenario 2: When roomInfo.roomType is TUIRoomType.kConference// and roomInfo.speechMode is TUISpeechMode.kSpeakAfterTakingSeat, General Users Go Liveawait roomEngine.takeSeat({seatIndex: -1,timeout: 0,});// Scenario 3: When roomInfo.enableSeatControl is true, General Users Go Liveconst 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 there is No Serial Number |
timeout | number | Required | - | Timeout. If timeout is set to 0, there is no Timeout |
requestCallback | Function | Optional | Empty Function | Callback, used to Notify Initiator of Request being Accepted/Rejected/Cancelled/Timeout/Error |
const roomEngine = new TUIRoomEngine();await roomEngine.leaveSeat();
const roomEngine = new TUIRoomEngine();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. If timeout is set to 0, there is no Timeout |
requestCallback | Function | Optional | Empty Function | Callback, used to Notify Initiator of Request being Accepted/Rejected/Cancelled/Timeout/Error |
const roomEngine = new TUIRoomEngine();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 = new TUIRoomEngine();await roomEngine.lockSeatByAdmin({seatIndex: 0,lockParams: {lockSeat: true,lockVideo: true,lockAudio: true,},});
Parameter | Type | Description | Default Value | Meaning |
seatIndex | number | Required | - | Mic position index |
lockParams | TUISeatLockParams | Required | - | Lock mic parameter |
const roomEngine = new TUIRoomEngine();await roomEngine.sendTextMessage({messageText: 'hello, everyone',});
Parameter | Type | Description | Default Value | Meaning |
messageText | string | Required | - | Text message content |
const roomEngine = new TUIRoomEngine();await roomEngine.sendCustomMessage({messageText: '{ data:'', description: ''}',});
Parameter | Type | Description | Default Value | Meaning |
messageText | string | Required | - | Custom message content |
const roomEngine = new TUIRoomEngine();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 = new TUIRoomEngine();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 = new TUIRoomEngine();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 = new TUIRoomEngine();await roomEngine.setCurrentCameraDevice({ deviceId: '' });
Parameter | Type | Description | Default Value | Meaning |
deviceId | string | Required | - | Device ID obtained from getCameraDevicesList |
const roomEngine = new TUIRoomEngine();await roomEngine.setCurrentMicDevice({ deviceId: '' });
Parameter | Type | Description | Default Value | Meaning |
deviceId | string | Required | - | Device ID obtained from getMicDevicesList |
const roomEngine = new TUIRoomEngine();await roomEngine.setCurrentSpeakerDevice({ deviceId: '' });
Parameter | Type | Description | Default Value | Meaning |
deviceId | string | Required | - | Device ID obtained from getSpeakerDevicesList |
const roomEngine = new TUIRoomEngine();const currentCameraDevice = roomEngine.getCurrentCameraDevice();
const roomEngine = new TUIRoomEngine();const currentMicDevice = roomEngine.getCurrentMicDevice();
const roomEngine = new TUIRoomEngine();const currentSpeakerDevice = roomEngine.getCurrentSpeakerDevice();
const roomEngine = new TUIRoomEngine();await roomEngine.startCameraDeviceTest({ view: 'test-preview' });
Parameter | Type | Description | Default Value | Meaning |
view | string | Required | - | Display the video area of the camera test, the input view is the Id of the div element carrying the preview screen |
const roomEngine = new TUIRoomEngine();await roomEngine.stopCameraDeviceTest();
const roomEngine = new TUIRoomEngine();roomEngine.on(event, func);
Parameter | Type | Description | Default Value | Meaning |
event | Required | - | TUIRoomEngine event list | |
func | Function | Required | - | Event callback function |
const roomEngine = new TUIRoomEngine();roomEngine.off(event, func);
Parameter | Type | Description | Default Value | Meaning |
event | Required | - | TUIRoomEngine event list | |
func | Function | Required | - | Event callback function |
const roomEngine = new TUIRoomEngine();const trtcCloud = roomEngine.getTRTCCloud();
const roomEngine = new TUIRoomEngine();const trtcCloud = roomEngine.getTIM();
Was this page helpful?