Data Structures | |
protocol | <TRTCCloudDelegate> |
protocol | <TRTCVideoRenderDelegate> |
protocol | <TRTCVideoFrameDelegate> |
protocol | <TRTCAudioFrameDelegate> |
protocol | <TRTCLogDelegate> |
Tencent Cloud TRTC Event Notification Interface.
Module: TRTCCloudDelegate @ TXLiteAVSDK Function: event callback APIs for TRTC’s video call feature
protocol TRTCCloudDelegate-p |
- (void) onAudioDeviceCaptureVolumeChanged: | (NSInteger) | volume | |
muted: | (BOOL) | muted | |
The capturing volume of the mic changed
On desktop OS such as macOS and Windows, users can set the capturing volume of the mic in the audio control panel. The higher volume a user sets, the higher the volume of raw audio captured by the mic. On some keyboards and laptops, users can also mute the mic by pressing a key (whose icon is a crossed out mic).
When users set the mic capturing volume via the UI or a keyboard shortcut, the SDK will return this callback.
interval
> 0) to enable the callback. To disable the callback, set interval
to 0
.volume | System audio capturing volume, which users can set in the audio control panel. Value range: 0-100 |
muted | Whether the mic is muted. YES : muted; NO : unmuted |
- (void) onAudioDevicePlayoutVolumeChanged: | (NSInteger) | volume | |
muted: | (BOOL) | muted | |
The playback volume changed
On desktop OS such as macOS and Windows, users can set the system’s playback volume in the audio control panel. On some keyboards and laptops, users can also mute the speaker by pressing a key (whose icon is a crossed out speaker).
When users set the system’s playback volume via the UI or a keyboard shortcut, the SDK will return this callback.
interval
> 0) to enable the callback. To disable the callback, set interval
to 0
.volume | The system playback volume, which users can set in the audio control panel. Value range: 0-100 |
muted | Whether the speaker is muted. YES : muted; NO : unmuted |
- (void) onAudioEffectFinished: | (int) | effectId | |
code: | (int) | code | |
Audio effects ended (disused)
- (void) onAudioRouteChanged: | (TRTCAudioRoute) | route | |
fromRoute: | (TRTCAudioRoute) | fromRoute | |
The audio route changed (for mobile devices only)
Audio route is the route (speaker or receiver) through which audio is played.
route | Audio route, i.e., the route (speaker or receiver) through which audio is played |
fromRoute | The audio route used before the change |
- (void) onCameraDidReady |
The camera is ready
After you call startLocalPreivew, the SDK will try to start the camera and return this callback if the camera is started. If it fails to start the camera, it’s probably because the application does not have access to the camera or the camera is being used. You can capture the onError callback to learn about the exception and let users know via UI messages.
- (void) onConnectionLost |
The SDK was disconnected from the cloud
The SDK returns this callback when it is disconnected from the cloud, which may be caused by network unavailability or change of network, for example, when the user walks into an elevator. After returning this callback, the SDK will attempt to reconnect to the cloud, and will return the onTryToReconnect callback. When it is reconnected, it will return the onConnectionRecovery callback. In other words, the SDK proceeds from one event to the next in the following order:
[onConnectionLost] =====> [onTryToReconnect] =====> [onConnectionRecovery] /|\ | |------------------------------------------------------|
- (void) onConnectionRecovery |
The SDK is reconnected to the cloud
When the SDK is disconnected from the cloud, it returns the onConnectionLost callback. It then attempts to reconnect and returns the onTryToReconnect callback. After it is reconnected, it returns this callback ({}).
- (void) onConnectOtherRoom: | (NSString *) | userId | |
errCode: | (TXLiteAVError) | errCode | |
errMsg: | (nullable NSString *) | errMsg | |
Result of requesting cross-room call
You can call the connectOtherRoom()
API in TRTCCloud
to establish a video call with the anchor of another room. This is the “anchor competition” feature. The caller will receive the onConnectOtherRoom()
callback, which can be used to determine whether the cross-room call is successful. If it is successful, all users in either room will receive the onUserVideoAvailable()
callback from the anchor of the other room.
userId | The user ID of the anchor (in another room) to be called |
errCode | Error code. ERR_NULL indicates that cross-room connection is established successfully. For more information, please see Error Codes. |
errMsg | Error message |
- (void) onDevice: | (NSString *) | deviceId | |
type: | (TRTCMediaDeviceType) | deviceType | |
stateChanged: | (NSInteger) | state | |
The status of a local device changed (for desktop OS only)
The SDK returns this callback when a local device (camera, mic, or speaker) is connected or disconnected.
deviceId | Device ID |
deviceType | Device type |
state | Device status. 0 : disconnected; 1 : connected |
- (void) onDisconnectOtherRoom: | (TXLiteAVError) | errCode | |
errMsg: | (nullable NSString *) | errMsg | |
Result of ending cross-room call
- (void) onEnterRoom: | (NSInteger) | result |
Whether room entry is successful
After calling the 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. For more information on the error codes for room entry failure, see Error Codes.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.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. |
- (void) onError: | (TXLiteAVError) | errCode | |
errMsg: | (nullable NSString *) | errMsg | |
extInfo: | (nullable NSDictionary *) | extInfo | |
Error event callback
Error event, which indicates that the SDK threw an irrecoverable error such as room entry failure or failure to start device For more information, see Error Codes.
errCode | Error code |
errMsg | Error message |
extInfo | Extended field. Certain error codes may carry extra information for troubleshooting. |
- (void) onExitRoom: | (NSInteger) | reason |
Room exit
Calling the exitRoom()
API in TRTCCloud
will trigger the execution of room exit-related logic, such as releasing resources of audio/video devices and codecs. After all resources occupied by the SDK are released, the SDK will return the onExitRoom()
callback.
If you need to call enterRoom()
again or switch to another audio/video SDK, please wait until you receive the onExitRoom()
callback. Otherwise, you may encounter problems such as the camera or mic being occupied.
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) onFirstAudioFrame: | (NSString *) | userId |
The SDK started playing the first audio frame of a remote user
The SDK returns this callback when it plays the first audio frame of a remote user. The callback is not returned for the playing of the first audio frame of the local user.
userId | User ID of the remote user |
- (void) onFirstVideoFrame: | (NSString *) | userId | |
streamType: | (TRTCVideoStreamType) | streamType | |
width: | (int) | width | |
height: | (int) | height | |
The SDK started rendering the first video frame of the local or a remote user
The SDK returns this event callback when it starts rendering your first video frame or that of a remote user. The 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.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. |
streamType | Video stream type. The primary stream (Main ) is usually used for camera images, and the substream (Sub ) for screen sharing images. |
width | Video width |
height | Video height |
- (void) onLocalRecordBegin: | (NSInteger) | errCode | |
storagePath: | (NSString *) | storagePath | |
Local recording started
When you call startLocalRecording to start local recording, the SDK returns this callback to notify you whether recording is started successfully.
errCode | Error code. 0 : recording started successfully; -1 : failed to start recording; -2 : incorrect file extension |
storagePath | Storage path of recording file |
- (void) onLocalRecordComplete: | (NSInteger) | errCode | |
storagePath: | (NSString *) | storagePath | |
Local recording stopped
When you call stopLocalRecording to stop local recording, the SDK returns this callback to notify you of the recording result.
errCode | Error code. 0 : recording succeeded; -1 : recording failed; -2 : recording was ended due to change of resolution or switch between the landscape and portrait mode. |
storagePath | Storage path of recording file |
- (void) onLocalRecording: | (NSInteger) | duration | |
storagePath: | (NSString *) | storagePath | |
Local media is being recorded
The SDK returns this callback regularly after local recording is started successfully via the calling of startLocalRecording. You can capture this callback to stay up to date with the status of the recording task. You can set the callback interval when calling startLocalRecording.
duration | Cumulative duration of recording, in milliseconds |
storagePath | Storage path of recording file |
- (void) onMicDidReady |
The mic is ready
After you call startLocalAudio, the SDK will try to start the mic and return this callback if the mic is started. If it fails to start the mic, it’s probably because the application does not have access to the mic or the mic is being used. You can capture the onError callback to learn about the exception and let users know via UI messages.
- (void) onMissCustomCmdMsgUserId: | (NSString *) | userId | |
cmdID: | (NSInteger) | cmdID | |
errCode: | (NSInteger) | errCode | |
missed: | (NSInteger) | missed | |
Loss of custom message
When you use sendCustomCmdMsg to send a custom UDP message, even if you enable reliable transfer (by setting reliable
to YES
), 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. If the sender sets reliable
to YES
, 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.
reliable
to YES
. userId | User ID |
cmdID | Command ID |
errCode | Error code |
missed | Number of lost messages |
- (void) onNetworkQuality: | (TRTCQualityInfo *) | localQuality | |
remoteQuality: | (NSArray< TRTCQualityInfo * > *) | remoteQuality | |
Real-time network quality statistics
This callback is returned every 2 seconds and notifies you of the upstream and downstream network quality detected by the SDK. The SDK uses a built-in proprietary algorithm to assess the current latency, bandwidth, and stability of the network and returns a result. If the result is 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.
localQuality
and remoteQuality
, if userId
is empty, it indicates that the network quality statistics of the local user are returned. Otherwise, the network quality statistics of a remote user are returned.localQuality | Upstream network quality |
remoteQuality | Downstream network quality |
- (void) onRecvCustomCmdMsgUserId: | (NSString *) | userId | |
cmdID: | (NSInteger) | cmdID | |
seq: | (UInt32) | seq | |
message: | (NSData *) | message | |
Receipt of custom message
When a user in a room uses sendCustomCmdMsg to send a custom message, other users in the room can receive the message through the onRecvCustomCmdMsg
callback.
userId | User ID |
cmdID | Command ID |
seq | Message serial number |
message | Message data |
- (void) onRecvSEIMsg: | (NSString *) | userId | |
message: | (NSData *) | message | |
Receipt of SEI message
If a user in the room uses sendSEIMsg to send an SEI message via video frames, other users in the room can receive the message through the onRecvSEIMsg
callback.
userId | User ID |
message | Data |
- (void) onRemoteUserEnterRoom: | (NSString *) | userId |
A user entered the room
Due to performance concerns, 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
): 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.onRemoteUserEnterRoom
callback indicates that a user entered the room, but it does not necessarily mean that the user enabled audio or video.onUserVideoAvailable()
callback. userId | User ID of the remote user |
- (void) onRemoteUserLeaveRoom: | (NSString *) | userId | |
reason: | (NSInteger) | reason | |
A user exited the room
As with 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.userId | User ID of the remote user |
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. |
- (void) onRemoteVideoStatusUpdated: | (NSString *) | userId | |
streamType: | (TRTCVideoStreamType) | streamType | |
streamStatus: | (TRTCAVStatusType) | status | |
reason: | (TRTCAVStatusChangeReason) | reason | |
extrainfo: | (nullable NSDictionary *) | info | |
Change of remote video status
You can use this callback to get the status (Playing
, Loading
, or Stopped
) of the video of each remote user and display it on the UI.
userId | User ID |
streamType | Video stream type. The primary stream (Main ) is usually used for camera images, and the substream (Sub ) for screen sharing images. |
status | Video status, which may be Playing , Loading , or Stopped |
reason | Reason for the change of status |
extraInfo | Extra information |
- (void) onScreenCapturePaused: | (int) | reason |
Screen sharing was paused
The SDK returns this callback when you call pauseScreenCapture to pause screen sharing.
reason | Reason.
|
- (void) onScreenCaptureResumed: | (int) | reason |
Screen sharing was resumed
The SDK returns this callback when you call resumeScreenCapture to resume screen sharing.
reason | Reason.
|
- (void) onScreenCaptureStarted |
Screen sharing started
The SDK returns this callback when you call startScreenCapture and other APIs to start screen sharing.
- (void) onScreenCaptureStoped: | (int) | reason |
Screen sharing stopped
The SDK returns this callback when you call stopScreenCapture to stop screen sharing.
reason | Reason. 0 : the user stopped screen sharing; 1 : screen sharing stopped because the shared window was closed. |
- (void) onSendFirstLocalAudioFrame |
The first local audio frame was published
After you enter a room and call startLocalAudio to enable audio capturing (whichever happens first), the SDK will start audio encoding and publish the local audio data via its network module to the cloud. The SDK returns the onSendFirstLocalAudioFrame
callback after sending the first local audio frame.
- (void) onSendFirstLocalVideoFrame: | (TRTCVideoStreamType) | streamType |
The first local video frame was published
After you enter a room and call startLocalPreview or startScreenCapture to enable local video capturing (whichever happens first), the SDK will start video encoding and publish the local video data via its network module to the cloud. It returns the onSendFirstLocalVideoFrame
callback after publishing the first local video frame.
streamType | Video stream type. The primary stream (Main ) is usually used for camera images, and the substream (Sub ) for screen sharing images. |
- (void) onSetMixTranscodingConfig: | (int) | err | |
errMsg: | (NSString *) | errMsg | |
Set the layout and transcoding parameters for On-Cloud MixTranscoding
When you call setMixTranscodingConfig to modify the layout and transcoding parameters for On-Cloud MixTranscoding, the SDK will sync the command to the CVM immediately. The SDK will then receive the execution result from the CVM and return the result to you via this callback.
err | 0 : successful; other values: failed |
errMsg | Error message |
- (void) onSpeedTestResult: | (TRTCSpeedTestResult *) | result |
Callback of network speed test
The callback is triggered by startSpeedTest:.
result | Speed test data, including loss rates, rtt and bandwidth rates, please refer to TRTCSpeedTestResult for details. |
- (void) onStartPublishCDNStream: | (int) | err | |
errMsg: | (NSString *) | errMsg | |
Started publishing to non-Tencent Cloud’s live streaming CDN
When you call startPublishCDNStream to start publishing streams to a non-Tencent Cloud’s live streaming CDN, the SDK will sync the command to the CVM immediately. The SDK will then receive the execution result from the CVM and return the result to you via this callback.
err | 0 : successful; other values: failed |
errMsg | Error message |
- (void) onStartPublishing: | (int) | err | |
errMsg: | (NSString *) | errMsg | |
Started publishing to Tencent Cloud CSS CDN
When you call startPublishing to publish streams to Tencent Cloud CSS CDN, the SDK will sync the command to the CVM immediately. The SDK will then receive the execution result from the CVM and return the result to you via this callback.
err | 0 : successful; other values: failed |
errMsg | Error message |
- (void) onStatistics: | (TRTCStatistics *) | statistics |
Real-time statistics on technical metrics
This callback is returned every 2 seconds and notifies you of the statistics on technical metrics related to video, audio, and network. The metrics are listed in TRTCStatistics:
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.statistics | Statistics, including local statistics and the statistics of remote users. For details, please see TRTCStatistics. |
- (void) onStopPublishCDNStream: | (int) | err | |
errMsg: | (NSString *) | errMsg | |
Stopped publishing to non-Tencent Cloud’s live streaming CDN
When you call stopPublishCDNStream to stop publishing to a non-Tencent Cloud’s live streaming CDN, the SDK will sync the command to the CVM immediately. The SDK will then receive the execution result from the CVM and return the result to you via this callback.
err | 0 : successful; other values: failed |
errMsg | Error message |
- (void) onStopPublishing: | (int) | err | |
errMsg: | (NSString *) | errMsg | |
Stopped publishing to Tencent Cloud CSS CDN
When you call stopPublishing to stop publishing streams to Tencent Cloud CSS CDN, the SDK will sync the command to the CVM immediately. The SDK will then receive the execution result from the CVM and return the result to you via this callback.
err | 0 : successful; other values: failed |
errMsg | Error message |
- (void) onSwitchRole: | (TXLiteAVError) | errCode | |
errMsg: | (nullable NSString *) | errMsg | |
Role switching
You can call the switchRole()
API in TRTCCloud
to switch between the anchor and audience roles. This is accompanied by a line switching process. After the switching, the SDK will return the onSwitchRole()
event callback.
errCode | Error code. ERR_NULL indicates a successful switch. For more information, please see Error Codes. |
errMsg | Error message |
- (void) onSwitchRoom: | (TXLiteAVError) | errCode | |
errMsg: | (nullable NSString *) | errMsg | |
Result of room switching
You can call the switchRoom()
API in TRTCCloud
to switch from one room to another. After the switching, the SDK will return the onSwitchRoom()
event callback.
errCode | Error code. ERR_NULL indicates a successful switch. For more information, please see Error Codes. |
errMsg | Error message |
- (void) onSystemAudioLoopbackError: | (TXLiteAVError) | err |
Whether system audio capturing is enabled successfully (for macOS only)
On macOS, you can call startSystemAudioLoopback to install an audio driver and have the SDK capture the audio played back by the system. In use cases such as video teaching and music live streaming, the teacher can use this feature to let the SDK capture the sound of the video played by his or her computer, so that students in the room can hear the sound too. The SDK returns this callback after trying to enable system audio capturing. To determine whether it is actually enabled, pay attention to the error parameter in the callback.
err | If it is ERR_NULL , system audio capturing is enabled successfully. Otherwise, it is not. |
- (void) onTryToReconnect |
The SDK is reconnecting to the cloud
When the SDK is disconnected from the cloud, it returns the onConnectionLost callback. It then attempts to reconnect and returns this callback (onTryToReconnect). After it is reconnected, it returns the onConnectionRecovery callback.
- (void) onUserAudioAvailable: | (NSString *) | userId | |
available: | (BOOL) | available | |
A remote user published/unpublished audio
If you receive the onUserAudioAvailable(userId, YES)
callback, it indicates that the user published audio.
userId | User ID of the remote user |
available | Whether the user published (or unpublished) audio. YES : published; NO : unpublished |
- (void) onUserEnter: | (NSString *) | userId |
An anchor entered the room (disused)
- (void) onUserExit: | (NSString *) | userId | |
reason: | (NSInteger) | reason | |
An anchor left the room (disused)
- (void) onUserSubStreamAvailable: | (NSString *) | userId | |
available: | (BOOL) | available | |
A remote user published/unpublished substream video
The substream is usually used for screen sharing images. If you receive the onUserSubStreamAvailable(userId, YES)
callback, it indicates that the user has available substream video. You can then call startRemoteSubStreamView to subscribe to the remote user’s video. If the subscription is successful, you will receive the onFirstVideoFrame(userid)
callback, which indicates that the first frame of the user is rendered.
userId | User ID of the remote user |
available | Whether the user published (or unpublished) substream video. YES : published; NO : unpublished |
- (void) onUserVideoAvailable: | (NSString *) | userId | |
available: | (BOOL) | available | |
A remote user published/unpublished primary stream video
The primary stream is usually used for camera images. If you receive the onUserVideoAvailable(userId, YES)
callback, it indicates that the user has available primary stream video. You can then call startRemoteView to subscribe to the remote user’s video. If the subscription is successful, you will receive the onFirstVideoFrame(userid)
callback, which indicates that the first video frame of the user is rendered.
If you receive the onUserVideoAvailable(userId, NO)
callback, it indicates that the video of the remote user is disabled, which may be because the user called muteLocalVideo or stopLocalPreview.
userId | User ID of the remote user |
available | Whether the user published (or unpublished) primary stream video. YES : published; NO : unpublished |
- (void) onUserVideoSizeChanged: | (NSString *) | userId | |
streamType: | (TRTCVideoStreamType) | streamType | |
newWidth: | (int) | newWidth | |
newHeight: | (int) | newHeight | |
Change of remote video size
If you receive the onUserVideoSizeChanged(userId, streamtype, newWidth, newHeight)
callback, it indicates that the user changed the video size. It may be triggered by setVideoEncoderParam
or setSubStreamEncoderParam
.
userId | User ID |
streamType | Video stream type. The primary stream (Main ) is usually used for camera images, and the substream (Sub ) for screen sharing images. |
newWidth | Video width |
newHeight | Video height |
- (void) onUserVoiceVolume: | (NSArray< TRTCVolumeInfo * > *) | userVolumes | |
totalVolume: | (NSInteger) | totalVolume | |
Volume
The SDK can assess the volume of each channel and return this callback on a regular basis. You can display, for example, a waveform or volume bar on the UI based on the statistics returned. You need to first call enableAudioVolumeEvaluation to enable the feature and set the interval for the callback. Note that the SDK returns this callback at the specified interval regardless of whether someone is speaking in the room. When no one is speaking in the room, userVolumes
is empty, and totalVolume
is 0
.
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.userVolumes | An array that represents the volume of all users who are speaking in the room. Value range: 0-100 |
totalVolume | The total volume of all remote users. Value range: 0-100 |
- (void) onWarning: | (TXLiteAVWarning) | warningCode | |
warningMsg: | (nullable NSString *) | warningMsg | |
extInfo: | (nullable NSDictionary *) | extInfo | |
Warning event callback
Warning event, which indicates that the SDK threw an error requiring attention, such as video lag or high CPU usage For more information, see Error Codes.
warningCode | Warning code |
warningMsg | Warning message |
extInfo | Extended field. Certain warning codes may carry extra information for troubleshooting. |
protocol TRTCVideoRenderDelegate-p |
Instance Methods | |
(void) | - onRenderVideoFrame:userId:streamType: |
|
optional |
Custom video rendering
If you have configured the callback of custom rendering for local or remote video, the SDK will return to you via this callback video frames that are otherwise sent to the rendering control, so that you can customize rendering.
frame | Video frames to be rendered |
userId | userId of the video source. This parameter can be ignored if the callback is for local video (setLocalVideoRenderDelegate ). |
streamType | Stream type. The primary stream (Main ) is usually used for camera images, and the substream (Sub ) for screen sharing images. |
protocol TRTCVideoFrameDelegate-p |
Instance Methods | |
(uint32_t) | - onProcessVideoFrame:dstFrame: |
(void) | - onGLContextDestory |
|
optional |
The OpenGL context in the SDK was destroyed
|
optional |
Video processing by third-party beauty filters
If you use a third-party beauty filter component, you need to configure this callback in TRTCCloud
to have the SDK return to you video frames that are otherwise pre-processed by TRTC. You can then send the video frames to the third-party beauty filter component for processing. As the data returned can be read and modified, the result of processing can be synced to TRTC for subsequent encoding and publishing.
srcFrame | Used to carry images captured by TRTC via the camera |
dstFrame | Used to receive video images processed by third-party beauty filters |
Case 1: the beauty filter component generates new textures If the beauty filter component you use generates a frame of new texture (for the processed image) during image processing, please set dstFrame.textureId
to the ID of the new texture in the callback function.
uint32_t onProcessVideoFrame(TRTCVideoFrame * _Nonnull)srcFrame dstFrame:(TRTCVideoFrame * _Nonnull)dstFrame{ self.frameID += 1; dstFrame.pixelBuffer = [[FURenderer shareRenderer] renderPixelBuffer:srcFrame.pixelBuffer withFrameId:self.frameID items:self.renderItems itemCount:self.renderItems.count]; return 0; }
Case 2: you need to provide target textures to the beauty filter component If the third-party beauty filter component you use does not generate new textures and you need to manually set an input texture and an output texture for the component, you can consider the following scheme:
protocol TRTCAudioFrameDelegate-p |
Instance Methods | |
(void) | - onCapturedRawAudioFrame: |
(void) | - onLocalProcessedAudioFrame: |
(void) | - onRemoteUserAudioFrame:userId: |
(void) | - onMixedPlayAudioFrame: |
(void) | - onMixedAllAudioFrame: |
|
optional |
Audio data captured by the local mic and pre-processed by the audio module
After you configure the callback of custom audio processing, the SDK will return via this callback the data captured and pre-processed (ANS, AEC, and AGC) in PCM format.
frame | Audio frames in PCM format |
|
optional |
Audio data captured by the local mic, pre-processed by the audio module, effect-processed and BGM-mixed
After you configure the callback of custom audio processing, the SDK will return via this callback the data captured, pre-processed (ANS, AEC, and AGC), effect-processed and BGM-mixed in PCM format, before it is submitted to the network module for encoding.
Instructions: You could write data to the TRTCAudioFrame.extraData
filed, in order to achieve the purpose of transmitting signaling. Because the data block of the audio frame header cannot be too large, we recommend you limit the size of the signaling data to only a few bytes when using this API. If extra data more than 100 bytes, it won't be sent. Other users in the room can receive the message through the TRTCAudioFrame.extraData
in onRemoteUserAudioFrame
callback in TRTCAudioFrameDelegate.
frame | Audio frames in PCM format |
|
optional |
Data mixed from all the captured and to-be-played audio in the SDK
After you configure the callback of custom audio processing, the SDK will return via this callback the data (PCM format) mixed from all captured and to-be-played audio in the SDK, so that you can customize recording.
frame | Audio frames in PCM format |
|
optional |
Data mixed from each channel before being submitted to the system for playback
After you configure the callback of custom audio processing, the SDK will return to you via this callback the data (PCM format) mixed from each channel before it is submitted to the system for playback.
frame | Audio frames in PCM format |
|
optional |
Audio data of each remote user before audio mixing
After you configure the callback of custom audio processing, the SDK will return via this callback the raw audio data (PCM format) of each remote user before mixing.
frame | Audio frames in PCM format |
userId | User ID |
protocol TRTCLogDelegate-p |
Instance Methods | |
(void) | - onLog:LogLevel:WhichModule: |
|
optional |
Printing of local log
If you want to capture the local log printing event, you can configure the log callback to have the SDK return to you via this callback all logs that are to be printed.
log | Log content |
level | Log level. For more information, please see TRTC_LOG_LEVEL . |
module | Reserved field, which is not defined at the moment and has a fixed value of TXLiteAVSDK . |