Skip to content

Latest commit

 

History

History
255 lines (190 loc) · 31.1 KB

API.md

File metadata and controls

255 lines (190 loc) · 31.1 KB

Overview

Basic APIs

API Description
getTRTCShareInstance Creates a TRTCCloud singleton.
destroyTRTCShareInstance Releases a TRTCCloud singleton.
addCallback Sets the callback API TRTCCloudCallback.
removeCallback Removes event callback.

Room APIs

API Description
enterRoom Enters a room. If the room does not exist, the system will create one automatically.
exitRoom Exits a room.
switchRole Switches roles. This API works only in live streaming scenarios (TRTC_APP_SCENE_LIVE and TRTC_APP_SCENE_VOICE_CHATROOM).
setDefaultStreamRecvMode Sets the audio/video data receiving mode, which must be set before room entry to take effect.
connectOtherRoom Requests a cross-room call (anchor competition).
disconnectOtherRoom Exits a cross-room call.
switchRoom Switches rooms.

CDN APIs

API Description
startPublishing Starts pushing to Tencent Cloud’s live streaming CDN.
stopPublishing Stops pushing to Tencent Cloud’s live streaming CDN.
startPublishCDNStream Starts relaying to the live streaming CDN of a non-Tencent Cloud vendor.
stopPublishCDNStream Stops relaying to non-Tencent Cloud addresses.
setMixTranscodingConfig Sets On-Cloud MixTranscoding parameters.

Video APIs

API Description
startLocalPreview Enables local video preview (only custom rendering is supported currently).
stopLocalPreview Stops local video capturing and preview.
muteLocalVideo Pauses/Resumes sending local video data.
startRemoteView Starts pulling and displaying the image of a specified remote user (only custom rendering is supported currently).
stopRemoteView Stops displaying and pulling the video image of a remote user.
stopAllRemoteView Stops displaying and pulling the video images of all remote users.
muteRemoteVideoStream Pauses/Resumes receiving the video stream of a specified remote user.
muteAllRemoteVideoStreams Pauses/Resumes receiving all remote video streams.
setVideoEncoderParam Sets video encoder parameters.
setNetworkQosParam Sets QoS control parameters.
setVideoEncoderMirror Sets the mirror mode of encoded images.

Audio APIs

API Description
startLocalAudio Enables local audio capturing and upstream data transfer.
stopLocalAudio Disables local audio capturing and upstream data transfer.
muteLocalAudio Mutes/Unmutes local audio.
muteRemoteAudio Mutes/Unmutes a specified remote user.
muteAllRemoteAudio Mutes/Unmutes all remote users.
setRemoteAudioVolume Sets the playback volume of a remote user.
setAudioCaptureVolume Sets the SDK capturing volume.
getAudioCaptureVolume Gets the SDK capturing volume.
setAudioPlayoutVolume Sets the SDK playback volume.
getAudioPlayoutVolume Gets the SDK playback volume.
enableAudioVolumeEvaluation Enables volume reminders.
startAudioRecording Starts audio recording.
stopAudioRecording Stops audio recording.

Device management APIs

API Description
getDeviceManager Gets the device management module. For details, please see Specific Device Management APIs.

Music and voice effect APIs

API Description
getAudioEffectManager Gets the audio effect management class TXAudioEffectManager, which is used to manage background music, short audio effects, and voice effects. For details, please see Specific Music and Voice Effect APIs.

Custom video rendering APIs

API Description
setLocalVideoRenderCallback Sets custom rendering for the local video.
setRemoteVideoRenderCallback Sets custom rendering for the video of a remote user.

Custom message sending APIs

API Description
sendSEIMsg Embeds small-volume custom data in video frames.

Network testing APIs

API Description
startSpeedTest Starts network speed testing. This may compromise the quality of video calls and should be avoided during a video call.
stopSpeedTest Stops server speed testing.

Log APIs

API Description
getSDKVersion Gets the SDK version.
setLogLevel Sets the log output level.
setLogDirPath Changes the path to save logs.
setLogCompressEnabled Enables/Disables local log compression.
callExperimentalAPI Calls the experimental API.

TRTCCloudCallback

Callback APIs for the TRTC audio call feature

Error and warning event callback APIs

API Description
onError Error callback. This indicates that the SDK encountered an irrecoverable error. Such errors must be listened for, and UI reminders should be displayed to users if necessary.
onWarning Warning callback. This alerts you to non-serious problems such as lag or recoverable decoding failure.

Room event callback APIs

API Description
onEnterRoom Callback of room entry
onExitRoom Callback of room exit
onSwitchRole Callback of role switching
onConnectOtherRoom Callback of the result of requesting a cross-room call (anchor competition)
onDisConnectOtherRoom Callback of the result of ending a cross-room call (anchor competition)
onSwitchRoom Callback of the result of room switching (switchRoom)

User event callback APIs

API Description
onRemoteUserEnterRoom Callback of the entry of a user
onRemoteUserLeaveRoom Callback of the exit of a user
onUserVideoAvailable Callback of whether a user has turned the camera on
onUserAudioAvailable Callback of whether a remote user has playable audio
onFirstVideoFrame Callback of rendering the first video frame of the local user or a remote user
onFirstAudioFrame Callback of playing the first audio frame of a remote user. No notifications are sent for local audio.
onSendFirstLocalVideoFrame Callback of sending the first local video frame
onSendFirstLocalAudioFrame Callback of sending the first local audio frame

Callback APIs for statistics on network quality and technical metrics

API Description
onNetworkQuality Callback of network quality. This callback is triggered every 2 seconds to collect statistics on the current upstream and downstream data transfer.
onStatistics Callback of statistics on technical metrics

Server event callback APIs

API Description
onConnectionLost Callback of the disconnection of the SDK from the server
onTryToReconnect Callback of the SDK trying to connect to the server again
onConnectionRecovery Callback of the reconnection of the SDK to the server
onSpeedTest Callback of server speed test results. The SDK tests the speed of multiple server addresses, and the result of each test is returned through this callback.

Hardware event callback APIs

API Description
onCameraDidReady Callback of the camera being ready
onMicDidReady Callback of the mic being ready
onUserVoiceVolume Callback of volume, including the volume of each userId and the total remote volume
onDeviceChange Callback of connecting/disconnecting a local device

Custom message receiving callback APIs

API Description
onRecvSEIMsg Callback of receiving an SEI message

Callback APIs for CDN relayed push

API Description
onStartPublishing Callback of starting to push to Tencent Cloud’s live streaming CDN, which corresponds to the startPublishing() API in TRTCCloud
onStopPublishing Callback of stopping pushing to Tencent Cloud’s live streaming CDN, which corresponds to the stopPublishing() API in TRTCCloud
onStartPublishCDNStream Callback of the completion of starting relayed push to CDNs
onStopPublishCDNStream Callback of the completion of stopping relayed push to CDNs
onSetMixTranscodingConfig Sets On-Cloud MixTranscoding parameters, which corresponds to the setMixTranscodingConfig() API in TRTCCloud

Definitions of Key Classes

Class Description
TRTCParams Room entry parameters
TRTCVideoEncParam Video encoding parameters
TRTCTranscodingConfig On-Cloud MixTranscoding configuration
TRTCSwitchRoomConfig Room switching parameters
TRTCNetworkQosParam QoS control parameters
TXVoiceReverbType Reverb effects (karaoke, room, hall, low and deep, resonant, etc.)
AudioMusicParam Parameters for music and voice effect setting APIs
TRTCAudioRecordingParams Audio recording parameters

Specific Device Management APIs

API Description
isFrontCamera Gets whether the front camera is being used.
switchCamera Switches cameras.
getCameraZoomMaxRatio Gets the maximum zoom level of the current camera.
setCameraZoomRatio Sets the zoom level of the current camera.
isAutoFocusEnabled Gets whether automatic facial recognition is supported.
enableCameraAutoFocus Enables/Disables automatic facial recognition.
setCameraFocusPosition Sets camera focus.
enableCameraTorch Enables/Disables flash.
setSystemVolumeType Sets the system volume type to use during calls.
setAudioRoute Sets the audio route.

Specific Music and Voice Effect APIs

API Description
setVoiceReverbType Sets the voice change effects (karaoke, room, hall, low and deep, resonant, etc.)
setMusicObserver Sets the callback of the playback progress of background music.
startPlayMusic Starts playing background music.
stopPlayMusic Stops playing background music.
pausePlayMusic Pauses background music.
resumePlayMusic Resumes playing background music.
setMusicPublishVolume Sets the remote playback volume of background music, i.e., the volume heard by remote users.
setMusicPlayoutVolume Sets the local playback volume of background music.
setAllMusicVolume Sets the local and remote playback volume of background music.
setMusicPitch Changes the pitch of background music.
setMusicSpeedRate Changes the playback speed of background music.
getMusicCurrentPosInMS Gets the playback progress (ms) of background music.
seekMusicToPosInMS Sets the playback progress (ms) of background music.
getMusicDurationInMS Gets the length (ms) of the background music file.