Room entry parameters


new TRTCParams(sdkAppId, userId, userSig, roomId, strRoomId, role, privateMapKey, businessInfo, streamId, userDefineRecordId)

As the room entry parameters in the TRTC SDK, these parameters must be correctly set so that the user can successfully enter the audio/video room specified by roomId or strRoomId. For historical reasons, TRTC supports two types of room IDs: roomId and strRoomId.

Notice: do not mix roomId and strRoomId, because they are not interchangeable. For example, the number 123 and the string 123 are two completely different rooms in TRTC.

Name Type Description
sdkAppId Number required

[Field description] application ID, which is required. Tencent Cloud generates bills based on sdkAppId.
[Recommended value] the ID can be obtained on the account information page in the TRTC console after the corresponding application is created.

userId String required

[Field description] user ID, which is required. It is the userId of the local user in UTF-8 encoding and acts as the username.
[Recommended value] if the ID of a user in your account system is "mike", userId can be set to "mike".

userSig String required

[Field description] user signature, which is required. It is the authentication signature corresponding to the current userId and acts as the login password for Tencent Cloud services.
[Recommended value] for the calculation method, please see UserSig.

roomId Number required

[Field description] numeric room ID. Users (userId) in the same room can see one another and make audio/video calls.
[Recommended value] value range: 1–4294967294.

strRoomId String required

[Field description] string-type room ID. Users (userId) in the same room can see one another and make audio/video calls.
[Recommended value] If you decide to use strRoomId, then roomId should be entered as 0. If both are entered, roomId will be used.

role TRTCRoleType required

[Field description] role in the live streaming scenario, which is applicable only to the live streaming scenario (TRTCAppSceneLIVE or TRTCAppSceneVoiceChatRoom) but doesn't take effect in the call scenario.
[Recommended value] default value: anchor (TRTCRoleAnchor).

privateMapKey String required

[Field description] permission credential used for permission control, which is optional. If you want only users with the specified userId values to enter a room, you need to use privateMapKey to restrict the permission.
[Recommended value] we recommend you use this parameter only if you have high security requirements. For more information, please see Enabling Advanced Permission Control.

businessInfo String required

[Field description] business data, which is optional. This field is needed only by some advanced features.
[Recommended value] do not set this field on your own.

streamId String required

[Field description] specified streamId in Tencent Cloud CSS, which is optional. After setting this field, you can play back the user's audio/video stream on Tencent Cloud CSS CDN through a standard pull scheme (FLV or HLS).
[Recommended value] this parameter can contain up to 64 bytes and can be left empty. We recommend you use sdkappid_roomid_userid_main as the streamid, which is easier to identify and will not cause conflicts in your multiple applications.
[Note] To use Tencent Cloud CSS CDN, you need to enable the auto-relayed live streaming feature on the "Function Configuration" page in the console first.
[Reference document] For more information, please see CDN Relayed Live Streaming.

userDefineRecordId String required

[Field description] on-cloud recording field, which is optional and used to specify whether to record the user's audio/video stream in the cloud.
[Recommended value] it can contain up to 64 bytes. Letters (a–z and A–Z), digits (0–9), underscores, and hyphens are allowed.
[Reference document] For more information, please see On-Cloud Recording and Playback.