FuncList | DESC |
Custom video rendering |
FuncList | DESC |
An OpenGL context was created in the SDK. | |
Video processing by third-party beauty filters | |
The OpenGL context in the SDK was destroyed |
FuncList | DESC |
Audio data captured by the local mic and pre-processed by the audio module | |
Audio data captured by the local mic, pre-processed by the audio module, effect-processed and BGM-mixed | |
Audio data of each remote user before audio mixing | |
Data mixed from each channel before being submitted to the system for playback | |
Data mixed from all the captured and to-be-played audio in the SDK | |
In-ear monitoring data |
FuncList | DESC |
Printing of local log |
FuncList | DESC |
Error event callback | |
Warning event callback | |
Whether room entry is successful | |
Room exit | |
Role switching | |
Result of room switching | |
Result of requesting cross-room call | |
Result of ending cross-room call | |
Result of changing the upstream capability of the cross-room anchor | |
A user entered the room | |
A user exited the room | |
A remote user published/unpublished primary stream video | |
A remote user published/unpublished substream video | |
A remote user published/unpublished audio | |
The SDK started rendering the first video frame of the local or a remote user | |
The SDK started playing the first audio frame of a remote user | |
The first local video frame was published | |
The first local audio frame was published | |
Change of remote video status | |
Change of remote audio status | |
Change of remote video size | |
Real-time network quality statistics | |
Real-time statistics on technical metrics | |
Callback of network speed test | |
The SDK was disconnected from the cloud | |
The SDK is reconnecting to the cloud | |
The SDK is reconnected to the cloud | |
The camera is ready | |
The mic is ready | |
The audio route changed (for mobile devices only) | |
Volume | |
Receipt of custom message | |
Loss of custom message | |
Receipt of SEI message | |
Started publishing to Tencent Cloud CSS CDN | |
Stopped publishing to Tencent Cloud CSS CDN | |
Started publishing to non-Tencent Cloud’s live streaming CDN | |
Stopped publishing to non-Tencent Cloud’s live streaming CDN | |
Set the layout and transcoding parameters for On-Cloud MixTranscoding | |
Callback for starting to publish | |
Callback for modifying publishing parameters | |
Callback for stopping publishing | |
Callback for change of RTMP/RTMPS publishing status | |
Screen sharing started | |
Screen sharing was paused | |
Screen sharing was resumed | |
Screen sharing stopped | |
Local recording started | |
Local media is being recorded | |
Record fragment finished. | |
Local recording stopped | |
Finished taking a local screenshot | |
An anchor entered the room (disused) | |
An anchor left the room (disused) | |
Audio effects ended (disused) | |
Result of server speed testing (disused) |
void onRenderVideoFrame | (String userId |
| int streamType |
|
Param | DESC |
frame | Video frames to be rendered |
streamType | Stream type. The primary stream ( Main ) is usually used for camera images, and the substream ( Sub ) for screen sharing images. |
userId | userId of the video source. This parameter can be ignored if the callback is for local video ( setLocalVideoRenderDelegate ). |
int onProcessVideoFrame | |
|
TRTCCloud
to have the SDK return to you video frames that are otherwise pre-processed by TRTC. dstFrame.textureId
to the ID of the new texture in the callback function.private final TRTCVideoFrameListener mVideoFrameListener = new TRTCVideoFrameListener() {@Overridepublic void onGLContextCreated() {mFURenderer.onSurfaceCreated();mFURenderer.setUseTexAsync(true);}@Overridepublic int onProcessVideoFrame(TRTCVideoFrame srcFrame, TRTCVideoFrame dstFrame) {dstFrame.texture.textureId = mFURenderer.onDrawFrameSingleInput(srcFrame.texture.textureId, srcFrame.width, srcFrame.height);return 0;}@Overridepublic void onGLContextDestory() {mFURenderer.onSurfaceDestroyed();}};
int onProcessVideoFrame(TRTCCloudDef.TRTCVideoFrame srcFrame, TRTCCloudDef.TRTCVideoFrame dstFrame) {thirdparty_process(srcFrame.texture.textureId, srcFrame.width, srcFrame.height, dstFrame.texture.textureId);return 0;}
Param | DESC |
dstFrame | Used to receive video images processed by third-party beauty filters |
srcFrame | Used to carry images captured by TRTC via the camera |
void onCapturedAudioFrame |
Param | DESC |
frame | Audio frames in PCM format |
void onLocalProcessedAudioFrame |
TRTCAudioFrame.extraData
filed, in order to achieve the purpose of transmitting signaling. TRTCAudioFrame.extraData
in onRemoteUserAudioFrame
callback in TRTCAudioFrameDelegate.Param | DESC |
frame | Audio frames in PCM format |
void onRemoteUserAudioFrame | |
| String userId) |
Param | DESC |
frame | Audio frames in PCM format |
userId | User ID |
void onMixedPlayAudioFrame |
Param | DESC |
frame | Audio frames in PCM format |
void onMixedAllAudioFrame |
Param | DESC |
frame | Audio frames in PCM format |
void onVoiceEarMonitorAudioFrame |
Param | DESC |
frame | Audio frames in PCM format |
void onLog | (String log |
| int level |
| String module) |
Param | DESC |
level | Log level. For more information, please see TRTC_LOG_LEVEL . |
log | Log content |
module | Reserved field, which is not defined at the moment and has a fixed value of TXLiteAVSDK . |
void onError | (int errCode |
| String errMsg |
| Bundle extraInfo) |
Param | DESC |
errCode | Error code |
errMsg | Error message |
extInfo | Extended field. Certain error codes may carry extra information for troubleshooting. |
void onWarning | (int warningCode |
| String warningMsg |
| Bundle extraInfo) |
Param | DESC |
extInfo | Extended field. Certain warning codes may carry extra information for troubleshooting. |
warningCode | Warning code |
warningMsg | Warning message |
void onEnterRoom | (long result) |
enterRoom()
API in TRTCCloud
to enter a room, you will receive the onEnterRoom(result)
callback from TRTCCloudDelegate
. result
will be a positive number ( result
> 0), indicating the time in milliseconds (ms) the room entry takes. result
will be a negative number (result < 0), indicating the error code for the failure.Param | DESC |
result | If result is greater than 0, it indicates the time (in ms) the room entry takes; if result is less than 0, it represents the error code for room entry. |
onEnterRoom(result)
callback is returned only if room entry succeeds, and the onError()
callback is returned if room entry fails. onEnterRoom(result)
callback is returned regardless of whether room entry succeeds or fails, and the onError()
callback is also returned if room entry fails.void onExitRoom | (int reason) |
exitRoom()
API in TRTCCloud
will trigger the execution of room exit-related logic, such as releasing resources of audio/video devices and codecs. onExitRoom()
callback. enterRoom()
again or switch to another audio/video SDK, please wait until you receive the onExitRoom()
callback.Param | DESC |
reason | Reason for room exit. 0 : the user called exitRoom to exit the room; 1 : the user was removed from the room by the server; 2 : the room was dismissed. |
void onSwitchRole | (final int errCode |
| final String errMsg) |
switchRole()
API in TRTCCloud
to switch between the anchor and audience roles. This is accompanied by a line switching process. onSwitchRole()
event callback.Param | DESC |
errCode | |
errMsg | Error message |
void onSwitchRoom | (final int errCode |
| final String errMsg) |
switchRoom()
API in TRTCCloud
to switch from one room to another. onSwitchRoom()
event callback.Param | DESC |
errCode | |
errMsg | Error message |
void onConnectOtherRoom | (final String userId |
| final int errCode |
| final String errMsg) |
connectOtherRoom()
API in TRTCCloud
to establish a video call with the anchor of another room. This is the “anchor competition” feature. onConnectOtherRoom()
callback, which can be used to determine whether the cross-room call is successful. onUserVideoAvailable()
callback from the anchor of the other room.Param | DESC |
errCode | Error code. ERR_NULL indicates that cross-room connection is established successfully. For more information, please see Error Codes. |
errMsg | Error message |
userId | The user ID of the anchor (in another room) to be called |
void onDisConnectOtherRoom | (final int errCode |
| final String errMsg) |
void onUpdateOtherRoomForwardMode | (final int errCode |
| final String errMsg) |
void onRemoteUserEnterRoom | (String userId) |
AppScene
, which you can specify by setting the second parameter when calling enterRoom
). TRTCAppSceneLIVE
or TRTCAppSceneVoiceChatRoom
): in live streaming scenarios, a user is either in the role of an anchor or audience. The callback is returned only when an anchor enters the room. TRTCAppSceneVideoCall
or TRTCAppSceneAudioCall
): in call scenarios, the concept of roles does not apply (all users can be considered as anchors), and the callback is returned when any user enters the room.Param | DESC |
userId | User ID of the remote user |
onRemoteUserEnterRoom
callback indicates that a user entered the room, but it does not necessarily mean that the user enabled audio or video. onUserVideoAvailable()
callback.void onRemoteUserLeaveRoom | (String userId |
| int reason) |
onRemoteUserEnterRoom
, this callback works differently in different scenarios (i.e., AppScene
, which you can specify by setting the second parameter when calling enterRoom
). TRTCAppSceneLIVE
or TRTCAppSceneVoiceChatRoom
): the callback is triggered only when an anchor exits the room. TRTCAppSceneVideoCall
or TRTCAppSceneAudioCall
): in call scenarios, the concept of roles does not apply, and the callback is returned when any user exits the room.Param | DESC |
reason | Reason for room exit. 0 : the user exited the room voluntarily; 1 : the user exited the room due to timeout; 2 : the user was removed from the room; 3 : the anchor user exited the room due to switch to audience. |
userId | User ID of the remote user |
void onUserVideoAvailable | (String userId |
| boolean available) |
onUserVideoAvailable(userId, true)
callback, it indicates that the user has available primary stream video. onFirstVideoFrame(userid)
callback, which indicates that the first video frame of the user is rendered. onUserVideoAvailable(userId, false)
callback, it indicates that the video of the remote user is disabled, which may be because the user called muteLocalVideo or stopLocalPreview.Param | DESC |
available | Whether the user published (or unpublished) primary stream video. true : published; false : unpublished |
userId | User ID of the remote user |
void onUserSubStreamAvailable | (String userId |
| boolean available) |
onUserSubStreamAvailable(userId, true)
callback, it indicates that the user has available substream video. onFirstVideoFrame(userid)
callback, which indicates that the first frame of the user is rendered.Param | DESC |
available | Whether the user published (or unpublished) substream video. true : published; false : unpublished |
userId | User ID of the remote user |
void onUserAudioAvailable | (String userId |
| boolean available) |
onUserAudioAvailable(userId, true)
callback, it indicates that the user published audio.Param | DESC |
available | Whether the user published (or unpublished) audio. true : published; false : unpublished |
userId | User ID of the remote user |
void onFirstVideoFrame | (String userId |
| int streamType |
| int width |
| int height) |
userId
in the callback can help you determine whether the frame is yours or a remote user’s. userId
is empty, it indicates that the SDK has started rendering your first video frame. The precondition is that you have called startLocalPreview or startScreenCapture. userId
is not empty, it indicates that the SDK has started rendering the first video frame of a remote user. The precondition is that you have called startRemoteView to subscribe to the user’s video.Param | DESC |
height | Video height |
streamType | Video stream type. The primary stream ( Main ) is usually used for camera images, and the substream ( Sub ) for screen sharing images. |
userId | The user ID of the local or a remote user. If it is empty, it indicates that the first local video frame is available; if it is not empty, it indicates that the first video frame of a remote user is available. |
width | Video width |
void onFirstAudioFrame | (String userId) |
Param | DESC |
userId | User ID of the remote user |
void onSendFirstLocalVideoFrame | (int streamType) |
onSendFirstLocalVideoFrame
callback after publishing the first local video frame.Param | DESC |
streamType | Video stream type. The primary stream ( Main ) is usually used for camera images, and the substream ( Sub ) for screen sharing images. |
onSendFirstLocalAudioFrame
callback after sending the first local audio frame.void onRemoteVideoStatusUpdated | (String userId |
| int streamType |
| int status |
| int reason |
| Bundle extraInfo) |
Playing
, Loading
, or Stopped
) of the video of each remote user and display it on the UI.Param | DESC |
extraInfo | Extra information |
reason | Reason for the change of status |
status | Video status, which may be Playing , Loading , or Stopped |
streamType | Video stream type. The primary stream ( Main ) is usually used for camera images, and the substream ( Sub ) for screen sharing images. |
userId | User ID |
void onRemoteAudioStatusUpdated | (String userId |
| int status |
| int reason |
| Bundle extraInfo) |
Playing
, Loading
, or Stopped
) of the audio of each remote user and display it on the UI.Param | DESC |
extraInfo | Extra information |
reason | Reason for the change of status |
status | Audio status, which may be Playing , Loading , or Stopped |
userId | User ID |
void onUserVideoSizeChanged | (String userId |
| int streamType |
| int newWidth |
| int newHeight) |
onUserVideoSizeChanged(userId, streamtype, newWidth, newHeight)
callback, it indicates that the user changed the video size. It may be triggered by setVideoEncoderParam
or setSubStreamEncoderParam
.Param | DESC |
newHeight | Video height |
newWidth | Video width |
streamType | Video stream type. The primary stream ( Main ) is usually used for camera images, and the substream ( Sub ) for screen sharing images. |
userId | User ID |
void onNetworkQuality | |
|
1
(excellent), it means that the current network conditions are excellent; if it is 6
(down), it means that the current network conditions are too bad to support TRTC calls.Param | DESC |
localQuality | Upstream network quality |
remoteQuality | Downstream network quality, it refers to the data quality finally measured on the local side after the data flow passes through a complete transmission link of "remote ->cloud ->local". Therefore, the downlink network quality here represents the joint impact of the remote uplink and the local downlink. |
void onStatistics |
resolution
), frame rate ( FPS
), bitrate ( bitrate
), etc. samplerate
), number of audio channels ( channel
), bitrate ( bitrate
), etc. rtt
) between the SDK and the cloud (SDK -> Cloud -> SDK), package loss rate ( loss
), upstream traffic ( sentBytes
), downstream traffic ( receivedBytes
), etc.Param | DESC |
statistics | Statistics, including local statistics and the statistics of remote users. For details, please see TRTCStatistics. |
void onSpeedTestResult |
Param | DESC |
result | Speed test data, including loss rates, rtt and bandwidth rates, please refer to TRTCSpeedTestResult for details. |
void onAudioRouteChanged | (int newRoute |
| int oldRoute) |
Param | DESC |
fromRoute | The audio route used before the change |
route | Audio route, i.e., the route (speaker or receiver) through which audio is played |
void onUserVoiceVolume | |
| int totalVolume) |
Param | DESC |
totalVolume | The total volume of all remote users. Value range: 0-100 |
userVolumes | An array that represents the volume of all users who are speaking in the room. Value range: 0-100 |
userVolumes
is an array. If userId
is empty, the elements in the array represent the volume of the local user’s audio. Otherwise, they represent the volume of a remote user’s audio.void onRecvCustomCmdMsg | (String userId |
| int cmdID |
| int seq |
| byte[] message) |
onRecvCustomCmdMsg
callback.Param | DESC |
cmdID | Command ID |
message | Message data |
seq | Message serial number |
userId | User ID |
void onMissCustomCmdMsg | (String userId |
| int cmdID |
| int errCode |
| int missed) |
reliable
to true
), there is still a chance of message loss. Reliable transfer only helps maintain a low probability of message loss, which meets the reliability requirements in most cases. reliable
to true
, the SDK will use this callback to notify the recipient of the number of custom messages lost during a specified time period (usually 5s) in the past.Param | DESC |
cmdID | Command ID |
errCode | Error code |
missed | Number of lost messages |
userId | User ID |
reliable
to true
.void onRecvSEIMsg | (String userId |
| byte[] data) |
onRecvSEIMsg
callback.Param | DESC |
message | Data |
userId | User ID |
void onStartPublishing | (int err |
| String errMsg) |
Param | DESC |
err | 0 : successful; other values: failed |
errMsg | Error message |
void onStopPublishing | (int err |
| String errMsg) |
Param | DESC |
err | 0 : successful; other values: failed |
errMsg | Error message |
void onStartPublishCDNStream | (int err |
| String errMsg) |
Param | DESC |
err | 0 : successful; other values: failed |
errMsg | Error message |
void onStopPublishCDNStream | (int err |
| String errMsg) |
Param | DESC |
err | 0 : successful; other values: failed |
errMsg | Error message |
void onSetMixTranscodingConfig | (int err |
| String errMsg) |
Param | DESC |
err | 0 : successful; other values: failed |
errMsg | Error message |
void onStartPublishMediaStream | (String taskId |
| int code |
| String message |
| Bundle extraInfo) |
Param | DESC |
code | : 0 : Successful; other values: Failed. |
extraInfo | : Additional information. For some error codes, there may be additional information to help you troubleshoot the issues. |
message | : The callback information. |
taskId | : If a request is successful, a task ID will be returned via the callback. You need to provide this task ID when you call updatePublishMediaStream to modify publishing parameters or stopPublishMediaStream to stop publishing. |
void onUpdatePublishMediaStream | (String taskId |
| int code |
| String message |
| Bundle extraInfo) |
Param | DESC |
code | : 0 : Successful; other values: Failed. |
extraInfo | : Additional information. For some error codes, there may be additional information to help you troubleshoot the issues. |
message | : The callback information. |
taskId | : The task ID you pass in when calling updatePublishMediaStream, which is used to identify a request. |
void onStopPublishMediaStream | (String taskId |
| int code |
| String message |
| Bundle extraInfo) |
Param | DESC |
code | : 0 : Successful; other values: Failed. |
extraInfo | : Additional information. For some error codes, there may be additional information to help you troubleshoot the issues. |
message | : The callback information. |
taskId | : The task ID you pass in when calling stopPublishMediaStream, which is used to identify a request. |
void onCdnStreamStateChanged | (String cdnUrl |
| int status |
| int code |
| String msg |
| Bundle extraInfo) |
Param | DESC |
cdnUrl | |
code | : The publishing result. 0 : Successful; other values: Failed. |
extraInfo | : Additional information. For some error codes, there may be additional information to help you troubleshoot the issues. |
message | : The publishing information. |
status | : The publishing status. 0: The publishing has not started yet or has ended. This value will be returned after you call stopPublishMediaStream. 1: The TRTC server is connecting to the CDN server. If the first attempt fails, the TRTC backend will retry multiple times and will return this value via the callback (every five seconds). After publishing succeeds, the value 2 will be returned. If a server error occurs or publishing is still unsuccessful after 60 seconds, the value 4 will be returned. 2: The TRTC server is publishing to the CDN. This value will be returned if the publishing succeeds. 3: The TRTC server is disconnected from the CDN server and is reconnecting. If a CDN error occurs or publishing is interrupted, the TRTC backend will try to reconnect and resume publishing and will return this value via the callback (every five seconds). After publishing resumes, the value 2 will be returned. If a server error occurs or the attempt to resume publishing is still unsuccessful after 60 seconds, the value 4 will be returned. 4: The TRTC server is disconnected from the CDN server and failed to reconnect within the timeout period. In this case, the publishing is deemed to have failed. You can call updatePublishMediaStream to try again. 5: The TRTC server is disconnecting from the CDN server. After you call stopPublishMediaStream, the SDK will return this value first and then the value 0 . |
void onScreenCaptureStopped | (int reason) |
Param | DESC |
reason | Reason. 0 : the user stopped screen sharing; 1 : screen sharing stopped because the shared window was closed. |
void onLocalRecordBegin | (int errCode |
| String storagePath) |
Param | DESC |
errCode | status. 0: successful. -1: failed. -2: unsupported format. -6: recording has been started. Stop recording first. -7: recording file already exists and needs to be deleted. -8: recording directory does not have the write permission. Please check the directory permission. |
storagePath | Storage path of recording file |
void onLocalRecording | (long duration |
| String storagePath) |
Param | DESC |
duration | Cumulative duration of recording, in milliseconds |
storagePath | Storage path of recording file |
void onLocalRecordFragment | (String storagePath) |
Param | DESC |
storagePath | Storage path of the fragment. |
void onLocalRecordComplete | (int errCode |
| String storagePath) |
Param | DESC |
errCode | status 0: successful. -1: failed. -2: Switching resolution or horizontal and vertical screen causes the recording to stop. -3: recording duration is too short or no video or audio data is received. Check the recording duration or whether audio or video capture is enabled. |
storagePath | Storage path of recording file |
void onSnapshotComplete | (Bitmap bmp) |
Param | DESC |
bmp | Screenshot result. If it is null , the screenshot failed to be taken. |
data | Screenshot data. If it is nullptr , it indicates that the SDK failed to take the screenshot. |
format | Screenshot data format. Only TRTCVideoPixelFormat_BGRA32 is supported now. |
height | Screenshot height |
length | Screenshot data length. In BGRA32 format, length = width * height * 4. |
type | Video stream type |
userId | User ID. If it is empty, the screenshot is a local image. |
width | Screenshot width |
void onUserEnter | (String userId) |
void onUserExit | (String userId |
| int reason) |
void onAudioEffectFinished | (int effectId |
| int code) |
void onSpeedTest | |
| int finishedCount |
| int totalCount) |
Was this page helpful?