TRTCParams class

Room entry parameters

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 .

Note: 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.

Constructors

TRTCParams({int sdkAppId = 0, String userId = "", String userSig = "", int roomId = 0, String strRoomId = "", TRTCRoleType role = TRTCRoleType.anchor, String streamId = "", String userDefineRecordId = "", String privateMapKey = "", String businessInfo = ""})

Properties

businessInfo String
  • Field description: business data, which is optional. This field applies only to some uncommon special requirements.
  • Recommended value: we recommend you not use this field
  • getter/setter pair
    hashCode int
    The hash code for this object.
    no setterinherited
    privateMapKey String
  • Field description: room signature, which is optional. If you want only users with the specified userIds 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.
  • getter/setter pair
    role TRTCRoleType
  • Field description: role in the live streaming scenario. The SDK uses this parameter to determine whether the user is an anchor or an audience user. This parameter is required in the live streaming scenario and optional in the call scenario.
  • Note: this parameter is applicable only to the live streaming scenario (TRTCAppScene.live or TRTCAppScene.voiceChatRoom) and doesn't take effect in the call scenario (AUDIOCALL or VIDEOCALL).
  • Recommended value: default value: anchor
  • getter/setter pair
    roomId int
  • 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.
  • Note:
    • roomId and strRoomId are mutually exclusive. If you decide to use strRoomId , then roomId should be entered as 0. If both are entered, roomId will be used.
    • 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.
  • getter/setter pair
    runtimeType Type
    A representation of the runtime type of the object.
    no setterinherited
    sdkAppId int
  • 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.
  • getter/setter pair
    streamId String
  • Field description: bound Tencent Cloud CSS CDN stream ID, which is optional. After setting this field, you can play back the user's audio/video stream on Tencent Cloud Live CDN through a standard live streaming 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 relayed live streaming feature on the "Function Configuration" page in the console first.
  • getter/setter pair
    strRoomId String
  • Field description: string-type room ID. Users (userId) in the same room can see one another and make audio/video calls.
  • Recommended value: the length limit is 64 bytes. The following 89 characters are supported: letters (a–z and A–Z), digits (0–9), space, "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", and ",".
  • Either roomId or strRoomId must be entered. If you decide to use strRoomId, then roomId should be entered as 0. If both are entered, roomId will prevail. Please note that when the same sdkAppId is used for interconnection, please be sure to use the same room ID type to avoid affecting the interconnection.
  • getter/setter pair
    userDefineRecordId String
  • Field description: on-cloud recording switch, which is used to specify whether to record the user's audio/video stream into a file in the specified format in the cloud.
  • Recommended value: it can contain up to 64 bytes of letters (a–z and A–Z), digits (0–9), underscores, and hyphens.
  • getter/setter pair
    userId String
    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".
    getter/setter pair
    userSig String
    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.
    getter/setter pair

    Methods

    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    toString() String
    A string representation of this object.
    inherited

    Operators

    operator ==(Object other) bool
    The equality operator.
    inherited