Options
All
  • Public
  • Public/Protected
  • All
Menu

Module trtc_cloud_def

Index

Type aliases

AudioMusicParam: { endTimeMS?: number; id: number; isShortFile?: boolean; loopCount?: number; path: string; publish?: boolean; startTimeMS?: number }
  • Music and audio effect API parameters

Type declaration

  • Optional endTimeMS?: number
    • Description: end time (ms) for music playback. 0 or -1 means to play the music to the end.
  • id: number
    • Description: music ID
    • Note: The SDK allows you to play multiple music tracks. You use music ID to identify a music track and control its playback, volume, etc.
  • Optional isShortFile?: boolean
    • Description: whether to play a short music file
    • Value: YES: short music track that needs to be looped; NO (default): normal-length music track
  • Optional loopCount?: number
    • Description: music loop times
    • Value: 0 (default value) or any positive integer. 0 indicates that the music is played once, 1 twice, and so on.
  • path: string
    • Description: absolute path of a music file
  • Optional publish?: boolean
    • Description: whether to send music to remote users
    • Value: YES: publish the music played locally to the cloud so that remote users can hear it; NO (default): play the music locally only and do not publish it
  • Optional startTimeMS?: number
    • Description: start time (ms) for music playback
TRTCAudioRecordingParams: { filePath: string }
  • Audio recording parameters
  • Description: the path to save the recording file (required). You need to specify a custom path and make sure that the path exists and is writable.
  • Note: The path must contain the filename and extension. The extension determines the format of the recording file. Supported formats include PCM, WAV, and AAC. For example, if you set this parameter to path/to/audio.aac, the recording file will be in AAC format. Please use a valid path that is readable and writable so that the recording file can be generated successfully.

Type declaration

  • filePath: string
TRTCMixUser: { height: number; roomId?: string; streamType?: number; userId: string; width: number; x: number; y: number; zOrder: number }
  • Position of each image in On-Cloud MixTranscoding
  • You can use TRTCMixUser to specify the position of the video image of each channel (userId).

Type declaration

  • height: number
    • Height (absolute pixel value) of an image layer
  • Optional roomId?: string
    • Room ID (roomId) of the users (userId) whose streams are to be mixed. null means the current room.
  • Optional streamType?: number
    • Whether the primary stream (TRTC_VIDEO_STREAM_TYPE_BIG, default) or screen sharing stream (TRTC_VIDEO_STREAM_TYPE_SUB) is mixed
  • userId: string
    • Users (userId) whose streams are to be mixed
  • width: number
    • Width (absolute pixel value) of an image layer
  • x: number
    • X coordinate (absolute pixel value) of an image layer
  • y: number
    • Y coordinate (absolute pixel value) of an image layer
  • zOrder: number
    • Layer number (1-15), which must be unique
TRTCNetworkQosParam: { controlMode: number; preference: number }
  • QoS control parameters
  • The settings determine the SDK’s QoS policy under different network conditions, for example, whether to prioritize clarity or smoothness under poor network conditions.

Type declaration

TRTCPublishCDNParam: { appId: number; bizId: number; url: string }
  • CDN relaying parameters

Type declaration

  • appId: number
    • Tencent Cloud appId. In the TRTC console, find the application you created, and click Application Info to view its ID in the Relayed Live Streaming Info section.
  • bizId: number
    • CSS bizid. In the TRTC console, find the application you created, and click Application Info to view its bizid in the Relayed Live Streaming Info section.
  • url: string
    • Relayed push URL
TRTCRenderParams: { fillMode: number; mirrorType: number; rotation: number }
  • Remote image parameters

Type declaration

  • fillMode: number

    -Description: image rendering mode

    -Notes:

    • The rendering mode may be aspect fill (the image may be stretched and cropped) or aspect fit (there may be black bars). The default value is TRTCCloudDef.TRTC_VIDEO_RENDER_MODE_FILL.
      • TRTCCloudDef.TRTC_VIDEO_RENDER_MODE_FILL: The image fills the entire screen, and the excess parts are cropped. The image may not be displayed in whole.
      • TRTCCloudDef.TRTC_VIDEO_RENDER_MODE_FIT: The long side of the image is stretched to fit the screen, and the blank area is filled with black bars. The image is displayed in whole.
  • mirrorType: number

    -Description: mirror mode

    -Notes:

      • TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_AUTO (default value): mirror the front camera but not the rear camera
      • TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE: mirror both the front and rear cameras
      • TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE: mirror neither the front nor rear camera
  • rotation: number

    -Description: clockwise image rotation

    -Notes: -* - TRTCCloudDef.TRTC_VIDEO_ROTATION_0 (default value): do not rotate -* - TRTCCloudDef.TRTC_VIDEO_ROTATION_90: rotate 90 degrees clockwise -* - TRTCCloudDef.TRTC_VIDEO_ROTATION_180: rotate 180 degrees clockwise -* - TRTCCloudDef.TRTC_VIDEO_ROTATION_270: rotate 270 degrees clockwise

TRTCSwitchRoomConfig: { privateMapKey?: string; roomId?: number; strRoomId?: string; userSig: string }
  • Room switch parameters

Type declaration

  • Optional privateMapKey?: string
    • Description: room signature (optional). You can use this parameter to allow only specified users (userId) to enter a room.
    • Value: Use this parameter only if you have high security requirements. For more information, please see Enabling Advanced Permission Control.
  • Optional roomId?: number
    • Description: numeric room ID (required). Users (userId) in the same room can see one another and make a video call.
    • Value: value range: 1-4294967294
  • Optional strRoomId?: string
    • Description: string-type room ID (optional). Users in the same room can see one another and make a video call.
    • Note: You must specify either roomId or strRoomId. If both are specified, roomId will be used.
  • userSig: string
    • Description: user signature (required) of the current userId, which functions as the login password for Tencent Cloud services
    • Value: For how to calculate user signatures, please see UserSig.
TRTCTranscodingConfig: { appId?: number; audioBitrate: number; audioChannels: number; audioSampleRate: number; backgroundColor?: number; backgroundImage?: string; bizId?: number; mixUsers?: TRTCMixUser[]; mode: number; streamId: string; videoBitrate: number; videoFramerate: number; videoGOP: number; videoHeight: number; videoWidth: number }
  • On-Cloud MixTranscoding configuration
  • Encoding quality of the mixed stream and position of each image

Type declaration

  • Optional appId?: number
    • Description: Tencent Cloud AppID

    -Value: In the TRTC console, find the application created, and click Application Info to view the bizId in the Relayed Live Streaming Info section.

  • audioBitrate: number

    -Description: audio bitrate (Kbps) of the transcoded stream -Value: value range: [32,192]. Default value: 64

  • audioChannels: number

    -Description: number of sound channels of the transcoded stream -Values: valid values: 1 (default value); 2

  • audioSampleRate: number

    -Description: audio sample rate (Hz) of the transcoded stream -Value: valid values: 12000, 16000, 22050, 24000, 32000, 44100, 48000 (default value)

  • Optional backgroundColor?: number

    -Description: background color of the mixed stream. The default color is black, and the value is a hex number. For example: "0x61B9F1" represents the RGB color (97,158,241). -Value: default value: 0x000000 (black)

  • Optional backgroundImage?: string
    • Description: background image of the mixed stream
    • Value: default value: null, which means that no background image is set

    -Note: You need to upload the image in Application Management > Function Configuration > Material Management in the console.

    •        You will get an image ID for the image uploaded, which you need to convert to a string before using it as the value of `backgroundImage`.<br>
      
    •        For example, if the image ID is `63`, you should set `backgroundImage` to `63`.<br>
      
  • Optional bizId?: number

    -Description: Tencent Cloud bizid -Value: In the TRTC console, find the application created, and click Application Info to view the bizId in the Relayed Live Streaming Info section.

  • Optional mixUsers?: TRTCMixUser[]

    -Description: position of each channel of image

  • mode: number

    -Description: transcoding configuration mode

  • streamId: string

    -Description: ID of the live stream pushed to CDN

    •      If you do not set this parameter, the SDK will execute the default logic, that is, it will mix multiple streams in the room into the video stream of the API caller, i.e., A + B => A.
      
    •      If you set this parameter, the SDK will mix multiple streams in the room into a new stream with the specified ID, i.e., A + B => C.
      

    -Value: default value: null, which indicates that multiple streams in the room are mixed into the video stream of the API caller

  • videoBitrate: number

    -Description: video bitrate (Kbps) of the transcoded stream -Value: If you set this parameter to 0, the backend will work out a bitrate based on videoWidth and videoHeight. You can also refer to the comment for the enumerated value TRTC_VIDEO_RESOLUTION_640_480.

  • videoFramerate: number

    -Description: frame rate (fps) of the transcoded stream -Value: value range: (0,30]. default value: 15

  • videoGOP: number

    -Description: keyframe interval (GOP) of the transcoded stream -Value: value range: [1,8]. default value: 2 (sec)

  • videoHeight: number

    -Description: video height (px) of the transcoded stream -Value: 640 is recommended. If audio-only streams are mixed, the mixing result will carry a video stream that shows a canvas background. To avoid this, set both the width and height to 0.

  • videoWidth: number

    -Description: video width (px) of the transcoded stream -Value: 360 is recommended. If audio-only streams are mixed, the mixing result will carry a video stream that shows a canvas background. To avoid this, set both the width and height to 0.

TRTCVideoEncParam: { enableAdjustRes: boolean; minVideoBitrate: number; videoBitrate: number; videoFps: number; videoResolution: number; videoResolutionMode: number }
  • Encoding parameters
  • Video encoder parameters, which determine the quality of video watched by remote users and recorded in the cloud

Type declaration

Generated using TypeDoc