Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • default

Index

Constructors

constructor

  • Returns default

Properties

Static _trtcCloud

_trtcCloud: undefined | default

Methods

callExperimentalAPI

  • callExperimentalAPI(jsonStr: string): Promise<void>
    • Call experimental APIs
    • Note: This API is used to call experimental APIs.

    Parameters

    • jsonStr: string

    Returns Promise<void>

connectOtherRoom

  • connectOtherRoom(param: string): Promise<void>
    • Request a cross-room call (anchor competition)
    • The cross-room call feature allows the anchors of two rooms to co-anchor without exiting their own rooms.
    • For example, after anchor A in room 001 uses connectOtherRoom() to successfully call anchor B in room 002, all users in room 001 will receive the onRemoteUserEnterRoom(B) and onUserVideoAvailable(B,true) callbacks, and all users in room 002 will receive the onRemoteUserEnterRoom(A) and onUserVideoAvailable(A,true) callbacks.
    • In essence, a cross-room call is sharing the audio and video of two anchors in different rooms to each other so that their audiences can see both anchors.
    • To ensure the compatibility of extended parameters for the cross-room call API, the JSON format is used for the parameters, which must contain at least two fields:
    • roomId: If anchor A in room 001 wants to call anchor B in room 002, he or she must set roomId to 002 when calling ConnectOtherRoom().
    • userId: If anchor A in room 001 wants to call anchor B in room 002, he or she must set userId to the user ID of anchor B when calling ConnectOtherRoom().
    • The result of requesting a cross-room call is returned through the onConnectOtherRoom() callback.
    • Sample call:
    • var object = new Map();
    • object['roomId'] = 155;
    • object['userId'] = '57890';
    • trtcCloud.connectOtherRoom(jsonEncode(object));

    Parameters

    • param: string

    Returns Promise<void>

disconnectOtherRoom

  • disconnectOtherRoom(): Promise<void>
    • Exit a cross-room call
    • The result of exiting a cross-room call is returned through the onDisconnectOtherRoom callback.

    Returns Promise<void>

enableAudioVolumeEvaluation

  • enableAudioVolumeEvaluation(intervalMs: number): Promise<void>
    • Enable the volume reminder
    • After the volume reminder is enabled, the SDK’s evaluation of volumes will be returned via the onUserVoiceVolume callback. This API works only if it is called before startLocalAudio().

    Parameters

    • intervalMs: number

    Returns Promise<void>

enterRoom

  • enterRoom(params: TRTCParams, scene: number): Promise<void>
    • Enter a room
    • After calling this API, you will receive the onEnterRoom(result) callback in TRTCCloudListener.
    • If room entry succeeded, result would be a positive number (result > 0), indicating the time in milliseconds (ms) room entry took.
    • If room entry failed, result would be a negative number (result < 0), which represents the error code.

    Parameters

    Returns Promise<void>

exitRoom

  • exitRoom(): Promise<void>
    • Exit a room
    • Calling exitRoom() will trigger the execution of room exit-related logic, including releasing resources such as audio/video devices and codecs. After all the resources are released, the SDK will notify you via the onExitRoom() callback.
    • If you need to call enterRoom() again or switch to another RTC SDK, please wait until you receive the onExitRoom() callback. Otherwise, you may encounter problems such as the camera or mic being occupied. The common issue of failure to switch between call volume and media volume on Android is caused by this problem.

    Returns Promise<void>

getAudioCaptureVolume

  • getAudioCaptureVolume(): Promise<number>
  • Get the capturing volume of the SDK

    Returns Promise<number>

getAudioEffectManager

    • Get the audio effect management class TXAudioEffectManager

    Returns default

    TXAudioEffectManager

getAudioPlayoutVolume

  • getAudioPlayoutVolume(): Promise<number>
  • Get the playback volume of the SDK

    Returns Promise<number>

getDeviceManager

    • Get the device management module

    Returns default

    TXDeviceManager

getSDKVersion

  • getSDKVersion(): Promise<string>
  • Returns Promise<string>

muteAllRemoteAudio

  • muteAllRemoteAudio(mute: boolean): Promise<void>
    • Mute/Unmute all users

    Parameters

    • mute: boolean

    Returns Promise<void>

muteLocalAudio

  • muteLocalAudio(mute: boolean): Promise<void>
    • Mute/Unmute the local user
    • After the local user is muted, other members in the room will receive the onUserAudioAvailable(userId, false) callback notification. After local audio is unmuted, other members in the room will receive the onUserAudioAvailable(userId, true) callback notification.
    • Different from stopLocalAudio, muteLocalAudio(true) does not stop the publishing of audio or video data. Data packets continue to be sent, although without audio and at extremely low bitrate. As MP4 and other video formats have high requirements on audio continuity, an MP4 recording file may not be played smoothly if stopLocalAudio is used. muteLocalAudio has less impact on the compatibility of MP4 recording files. Therefore, you are advised to use muteLocalAudio in scenarios with high requirements on recording quality.

    Parameters

    • mute: boolean

    Returns Promise<void>

muteRemoteAudio

  • muteRemoteAudio(userId: string, mute: boolean): Promise<void>
    • Mute/Unmute a remote user

    Parameters

    • userId: string
    • mute: boolean

    Returns Promise<void>

registerListener

setAudioCaptureVolume

  • setAudioCaptureVolume(volume: number): Promise<void>
    • Set the capturing volume of the SDK

    Parameters

    • volume: number

    Returns Promise<void>

setAudioPlayoutVolume

  • setAudioPlayoutVolume(volume: number): Promise<void>
    • Set the playback volume of the SDK
    • This API controls the volume of audio delivered to the system for playback. It affects the volume of local recording files, but not the volume of in-ear monitoring.

    Parameters

    • volume: number

    Returns Promise<void>

setConsoleEnabled

  • setConsoleEnabled(enabled: boolean): Promise<void>
    • Enable/Disable console log printing

    Parameters

    • enabled: boolean

    Returns Promise<void>

setDefaultStreamRecvMode

  • setDefaultStreamRecvMode(autoRecvAudio: boolean, autoRecvVideo: boolean): Promise<void>
    • Set the audio/video receiving mode (must be called before room entry to take effect)
    • To enable instant streaming, the SDK automatically receives audio/video upon successful room entry. This means you will receive the audio and video data of all remote users right after you enter a room. If you do not call startRemoteView, video data will be automatically canceled after the timeout period elapses. If your application scenario involves only audio (e.g., audio chat), you can use this API to disable automatic video data receiving.

    Parameters

    • autoRecvAudio: boolean
    • autoRecvVideo: boolean

    Returns Promise<void>

setLogCompressEnabled

  • setLogCompressEnabled(enabled: boolean): Promise<void>
    • Enable/Disable local log compression
    • If compression is enabled, log size will reduce significantly, but logs can be read only after being decompressed by the Python script provided by Tencent Cloud. If compression is disabled, logs will be stored in plaintext and will take up more storage space, but they can be read directly in Notepad.

    Parameters

    • enabled: boolean

    Returns Promise<void>

setLogDirPath

  • setLogDirPath(path: string): Promise<void>
    • Modify log storage path
    • Log files are stored in /app directory/files/log/tencent/liteav/ by default. To change the path, call this API before calling others. Make sure that the directory exists and the application has read/write access to the directory.

    Parameters

    • path: string

    Returns Promise<void>

setLogLevel

  • setLogLevel(level: number): Promise<void>
    • Set the log output level

    Parameters

    • level: number

    Returns Promise<void>

setRemoteAudioVolume

  • setRemoteAudioVolume(userId: string, volume: number): Promise<void>
    • Set the playback volume of a remote user

    Parameters

    • userId: string
    • volume: number

    Returns Promise<void>

startAudioRecording

    • Start audio recording
    • After this API is called, the SDK will record all audio of a call, including local audio, remote audio, and background music, into a file. This API works regardless of whether a user is in the room. When exitRoom is called, audio recording will stop automatically.

    Parameters

    Returns Promise<number>

    0: recording successful; -1: recording has started; -2: failed to create the file or directory; -3: unsupported audio format; -1001: invalid parameter

startLocalAudio

  • startLocalAudio(quality: number): Promise<void>
    • Start capturing and publishing audio and set audio quality
    • This API will start mic capturing and send audio data to other users in the room. The SDK does not start local audio capturing or publishing automatically. You need to call this API to start it manually so that other users in the room can hear you.
    • Higher audio quality of the anchor means better listening experience for audience, but high audio quality relies on high bandwidth. Therefore, video may stutter if bandwidth is insufficient.

    Parameters

    • quality: number

    Returns Promise<void>

startPublishCDNStream

    • Start relaying to the live streaming CDN of a non-Tencent Cloud vendor
    • This API is similar to startPublishing(), but startPublishCDNStream() supports relaying to the live streaming CDN of a non-Tencent Cloud vendor.
    • @param CDN relaying parameters. For more information, please see TRTCPublishCDNParam.
    • Notes:
    • Using startPublishing() to bind Tencent Cloud’s live streaming CDN does not incur fees, but using startPublishCDNStream() to bind the live streaming CDN of a non-Tencent Cloud vendor incurs relaying fees.

    Parameters

    Returns Promise<void>

startPublishing

  • startPublishing(streamId: string, streamType: number): Promise<void>
    • Start publishing stream to Tencent Cloud’s live streaming CDN
    • When calling this API, you need to specify a StreamId for the current user in Tencent Cloud’s CDN, which is used to splice the CDN playback address of the user.
    • For example, if you set the StreamId of the current user's primary stream to user_stream_001, the CDN playback address of the user’s primary stream will be http://yourdomain/live/user_stream_001.flv, where yourdomain is the domain name you use for playback. You can configure your playback domain name in the CSS console. Tencent Cloud doesn't provide a default playback domain name.
    • You can also specify the streamId when setting the TRTCParams parameter of enterRoom. This method is recommended.

    Parameters

    • streamId: string
    • streamType: number

    Returns Promise<void>

startSpeedTest

  • startSpeedTest(sdkAppId: number, userId: string, userSig: string): Promise<void>
    • Start network speed testing, which should be avoided during video calls to ensure call quality
    • The testing result can be used to optimize the SDK's server selection policy, so you are advised to run the test before the first call, which will help the SDK select the optimal server. If the result is unsatisfactory, you can show a UI message asking users to change to a better network. The result is returned via the TRTCCloudListener.onSpeedTest callback.
    • Note: Speed testing consumes traffic and consequently generates a small traffic fee.

    Parameters

    • sdkAppId: number
    • userId: string
    • userSig: string

    Returns Promise<void>

stopAudioRecording

  • stopAudioRecording(): Promise<void>
    • Stop audio recording
    • When exitRoom is called, audio recording will stop automatically.

    Returns Promise<void>

stopLocalAudio

  • stopLocalAudio(): Promise<void>
    • Stop capturing and publishing audio
    • After local audio capturing and publishing stop, other users in the room will receive the onUserAudioAvailable(false) callback.

    Returns Promise<void>

stopPublishCDNStream

  • stopPublishCDNStream(): Promise<void>
  • Stop relaying to non-Tencent Cloud address

    Returns Promise<void>

stopPublishing

  • stopPublishing(): Promise<void>
  • Stop publishing stream to Tencent Cloud’s live streaming CDN

    Returns Promise<void>

stopSpeedTest

  • stopSpeedTest(): Promise<void>
  • Stop server speed testing

    Returns Promise<void>

switchRole

  • switchRole(role: number): Promise<void>
    • Switch roles (applicable only to the live streaming scenarios TRTC_APP_SCENE_LIVE and TRTC_APP_SCENE_VOICE_CHATROOM)
    • In live streaming scenarios, a user may need to switch between the anchor role and audience role. You can specify your role during room entry by specifying the role parameter in TRTCParams. You can also call switchRole to switch the role after room entry.

    Parameters

    • role: number

    Returns Promise<void>

switchRoom

    • Switch rooms
    • After calling this API, you will exit the current room and stop publishing local audio/video and playing remote audio/video, but local video preview will continue. After you enter a new room, the publishing of local audio/video will resume automatically.
    • The result of the API call is returned through the onSwitchRoom(errCode, errMsg) callback.

    Parameters

    Returns Promise<void>

unRegisterListener

Static destroySharedInstance

  • destroySharedInstance(): void
  • Terminate a TRTCCloud singleton

    Returns void

Static sharedInstance

  • Create a TRTCCloud singleton

    Returns default

Generated using TypeDoc