Data Structures | |
class | TRTCParams |
class | TRTCVideoEncParam |
class | TRTCNetworkQosParam |
class | TRTCRenderParams |
class | TRTCQualityInfo |
class | TRTCVolumeInfo |
class | TRTCSpeedTestParams |
class | TRTCSpeedTestResult |
class | TRTCVideoFrame |
class | TRTCAudioFrame |
class | TRTCMixUser |
class | TRTCTranscodingConfig |
class | TRTCPublishCDNParam |
class | TRTCAudioRecordingParams |
class | TRTCLocalRecordingParams |
class | TRTCAudioEffectParam |
class | TRTCSwitchRoomConfig |
class | TRTCAudioFrameDelegateFormat |
class | TRTCScreenCaptureSourceInfo |
class | TRTCAudioParallelParams |
Typedefs | |
typedef UIView | TXView |
typedef UIImage | TXImage |
typedef UIEdgeInsets | TXEdgeInsets |
typedef TXMediaDeviceInfo | TRTCMediaDeviceInfo |
Enumerations | |
enum | TRTCVideoResolution : NSInteger |
enum | TRTCVideoResolutionMode : NSInteger |
enum | TRTCVideoStreamType : NSInteger |
enum | TRTCVideoFillMode : NSInteger |
enum | TRTCVideoRotation : NSInteger |
enum | TRTCBeautyStyle : NSInteger |
enum | TRTCVideoPixelFormat : NSInteger |
enum | TRTCVideoBufferType : NSInteger |
enum | TRTCVideoMirrorType : NSUInteger |
enum | TRTCLocalVideoMirrorType : NSUInteger |
enum | TRTCSnapshotSourceType : NSUInteger |
enum | TRTCAppScene : NSInteger |
enum | TRTCRoleType : NSInteger |
enum | TRTCQosControlMode : NSInteger |
enum | TRTCVideoQosPreference : NSInteger |
enum | TRTCQuality : NSInteger |
enum | TRTCAVStatusType : NSUInteger |
enum | TRTCAVStatusChangeReason : NSUInteger |
enum | TRTCAudioSampleRate : NSInteger |
enum | TRTCAudioQuality : NSInteger |
enum | TRTCAudioRoute : NSInteger |
enum | TRTCReverbType : NSInteger |
enum | TRTCVoiceChangerType : NSInteger |
enum | TRTCSystemVolumeType : NSInteger |
enum | TRTCLogLevel : NSInteger |
enum | TRTCGSensorMode : NSInteger |
enum | TRTCScreenCaptureSourceType : NSInteger |
enum | TRTCTranscodingConfigMode : NSInteger |
enum | TRTCRecordType : NSUInteger |
enum | TRTCMixInputType : NSUInteger |
enum | TRTCMediaDeviceType : NSInteger |
enum | TRTCAudioRecordingContent : NSUInteger |
Tencent Cloud TRTC Key Type Definition.
Module: TRTC key class definition Description: definitions of enumerated and constant values such as resolution and quality level
class TRTCParams |
Room entry parameters
As the room entry parameters in the TRTC SDK, these parameters must be correctly set so that the user can successfully enter the audio/video room specified by roomId
or strRoomId
. For historical reasons, TRTC supports two types of room IDs: roomId
and strRoomId
. Note: do not mix roomId
and strRoomId
, because they are not interchangeable. For example, the number 123
and the string 123
are two completely different rooms in TRTC.
Properties | |
UInt32 | sdkAppId |
NSString * | userId |
NSString * | userSig |
UInt32 | roomId |
NSString * | strRoomId |
TRTCRoleType | role |
NSString * | streamId |
NSString * | userDefineRecordId |
NSString * | privateMapKey |
NSString * | bussInfo |
|
readwritenonatomiccopy |
|
readwritenonatomiccopy |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomiccopy |
|
readwritenonatomiccopy |
|
readwritenonatomiccopy |
|
readwritenonatomiccopy |
|
readwritenonatomiccopy |
class TRTCVideoEncParam |
Video encoding parameters
These settings determine the quality of image viewed by remote users as well as the image quality of recorded video files in the cloud.
Properties | |
TRTCVideoResolution | videoResolution |
TRTCVideoResolutionMode | resMode |
int | videoFps |
int | videoBitrate |
int | minVideoBitrate |
BOOL | enableAdjustRes |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
Recommended value: 15 or 20 fps. If the frame rate is lower than 5 fps, there will be obvious lagging; if lower than 10 fps but higher than 5 fps, there will be slight lagging; if higher than 20 fps, the bandwidth will be wasted (the frame rate of movies is generally 24 fps). Note: the front cameras on certain Android phones do not support a capturing frame rate higher than 15 fps. For some Android phones that focus on beautification features, the capturing frame rate of the front cameras may be lower than 10 fps.
|
readwritenonatomicassign |
class TRTCNetworkQosParam |
Network QoS control parameter set
Network QoS control parameter. The settings determine the QoS control policy of the SDK in weak network conditions (e.g., whether to "ensure clarity" or "ensure smoothness").
Properties | |
TRTCVideoQosPreference | preference |
TRTCQosControlMode | controlMode |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
class TRTCRenderParams |
Rendering parameters of video image
You can use these parameters to control the video image rotation angle, fill mode, and mirror mode.
Properties | |
TRTCVideoRotation | rotation |
TRTCVideoFillMode | fillMode |
TRTCVideoMirrorType | mirrorType |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
class TRTCQualityInfo |
Network quality
This indicates the quality of the network. You can use it to display the network quality of each user on the UI.
Properties | |
NSString * | userId |
TRTCQuality | quality |
|
readwritenonatomicassign |
Network quality.
|
readwritenonatomiccopy |
User ID.
class TRTCVolumeInfo |
Volume
This indicates the audio volume value. You can use it to display the volume of each user in the UI.
Properties | |
NSString * | userId |
NSUInteger | volume |
|
readwritenonatomiccopy |
userId
of the speaker. An empty value indicates the local user.
|
readwritenonatomicassign |
Volume of the speaker. Value range: 0–100.
class TRTCSpeedTestParams |
Network speed testing parameters
You can test the network speed through the startSpeedTest: interface before the user enters the room (this API cannot be called during a call).
Properties | |
uint32_t | sdkAppId |
NSString * | userId |
NSString * | userSig |
NSInteger | expectedUpBandwidth |
NSInteger | expectedDownBandwidth |
|
readwritenonatomicassign |
Expected downstream bandwidth (kbps, value range: 10 to 5000, no downlink bandwidth test when it is 0).
|
readwritenonatomicassign |
Expected upstream bandwidth (kbps, value range: 10 to 5000, no uplink bandwidth test when it is 0).
|
readwritenonatomicassign |
Application identification, please refer to the relevant instructions in TRTCParams.
|
readwritenonatomiccopy |
User identification, please refer to the relevant instructions in TRTCParams.
|
readwritenonatomiccopy |
User signature, please refer to the relevant instructions in TRTCParams.
class TRTCSpeedTestResult |
Network speed test result
The startSpeedTest: API can be used to test the network speed before a user enters a room (this API cannot be called during a call).
Properties | |
BOOL | success |
NSString * | errMsg |
NSString * | ip |
TRTCQuality | quality |
float | upLostRate |
float | downLostRate |
uint32_t | rtt |
NSInteger | availableUpBandwidth |
NSInteger | availableDownBandwidth |
|
readwritenonatomicassign |
Downstream bandwidth (in kbps, -1: invalid value).
|
readwritenonatomicassign |
Upstream bandwidth (in kbps, -1: invalid value).
|
readwritenonatomicassign |
Downstream packet loss rate between 0 and 1.0. For example, 0.2 indicates that 2 data packets may be lost in every 10 packets received from the server.
|
readwritenonatomiccopy |
Error message for network speed test.
|
readwritenonatomiccopy |
Server IP address.
|
readwritenonatomicassign |
Network quality, which is tested and calculated based on the internal evaluation algorithm. For more information, please see TRTCQuality.
|
readwritenonatomicassign |
Delay in milliseconds, which is the round-trip time between the current device and TRTC server. The smaller the value, the better. The normal value range is 10–100 ms.
|
readwritenonatomicassign |
Whether the network speed test is successful.
|
readwritenonatomicassign |
Upstream packet loss rate between 0 and 1.0. For example, 0.3 indicates that 3 data packets may be lost in every 10 packets sent to the server.
class TRTCVideoFrame |
Video frame information
TRTCVideoFrame
is used to describe the raw data of a frame of the video image, which is the image data before frame encoding or after frame decoding.
Properties | |
uint32_t | width |
uint32_t | height |
uint64_t | timestamp |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
class TRTCAudioFrame |
Audio frame data
class TRTCMixUser |
Description information of each video image in On-Cloud MixTranscoding
TRTCMixUser
is used to specify the location, size, layer, and stream type of each video image in On-Cloud MixTranscoding.
Properties | |
BOOL | pureAudio |
TRTCMixInputType | inputType |
int | renderMode |
NSString * | image |
|
readwritenonatomiccopy |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
class TRTCTranscodingConfig |
Layout and transcoding parameters of On-Cloud MixTranscoding
These parameters are used to specify the layout position information of each video image and the encoding parameters of mixtranscoding during On-Cloud MixTranscoding.
Properties | |
TRTCTranscodingConfigMode | mode |
int | appId |
int | bizId |
int | videoWidth |
int | videoHeight |
int | videoBitrate |
int | videoFramerate |
int | videoGOP |
int | backgroundColor |
NSString * | backgroundImage |
int | audioSampleRate |
int | audioBitrate |
int | audioChannels |
int | audioCodec |
NSArray< TRTCMixUser * > * | mixUsers |
NSString * | streamId |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomiccopy |
|
readwritenonatomicassign |
|
readwritenonatomiccopy |
|
readwritenonatomicassign |
|
readwritenonatomiccopy |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
class TRTCPublishCDNParam |
Push parameters required to be set when publishing audio/video streams to non-Tencent Cloud CDN
TRTC's backend service supports publishing audio/video streams to third-party live CDN service providers through the standard RTMP protocol. If you use the Tencent Cloud CSS CDN service, you don't need to care about this parameter; instead, just use the startPublish API.
Properties | |
int | appId |
int | bizId |
NSString * | url |
NSString * | streamId |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicstrong |
|
readwritenonatomicstrong |
class TRTCAudioRecordingParams |
Local audio file recording parameters
This parameter is used to specify the recording parameters in the audio recording API startAudioRecording.
Properties | |
NSString * | filePath |
TRTCAudioRecordingContent | recordingContent |
|
readwritenonatomicstrong |
|
readwritenonatomicassign |
class TRTCLocalRecordingParams |
Local media file recording parameters
This parameter is used to specify the recording parameters in the local media file recording API startLocalRecording. The startLocalRecording
API is an enhanced version of the startAudioRecording
API. The former can record video files, while the latter can only record audio files.
Properties | |
NSString * | filePath |
|
readwritenonatomiccopy |
class TRTCAudioEffectParam |
Sound effect parameter (disused)
"Sound effects" in TRTC refer to some short audio files (usually only a few seconds), such as "applause" and "laughter". This parameter is used to specify the path and number of playback times of a sound effect file (short audio file) in the sound effect playback API TRTCCloud#playAudioEffect on legacy versions. After v7.3, the sound effect API has been replaced by a new TXAudioEffectManager#startPlayMusic API. When you specify the TXAudioMusicParam parameter of startPlayMusic
, if isShortFile
is set to YES
, the file is a "sound effect" file.
Instance Methods | |
(_Nonnull instancetype) | - init |
(_Nonnull instancetype) | - initWith:path: |
Class Methods | |
(_Nonnull instancetype) | + new |
Properties | |
int | effectId |
int | loopCount |
BOOL | publish |
int | volume |
- (_Nonnull instancetype) init |
- (_Nonnull instancetype) initWith: | (int) | effectId | |
path: | (NSString *_Nonnull) | path | |
+ (_Nonnull instancetype) new |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
class TRTCSwitchRoomConfig |
Room switch parameter
This parameter is used for the room switch API switchRoom, which can quickly switch a user from one room to another.
Properties | |
UInt32 | roomId |
NSString * | strRoomId |
NSString * | userSig |
NSString * | privateMapKey |
|
readwritenonatomiccopy |
|
readwritenonatomicassign |
|
readwritenonatomiccopy |
|
readwritenonatomiccopy |
class TRTCAudioFrameDelegateFormat |
Format parameter of custom audio callback
This parameter is used to set the relevant format (including sample rate and number of channels) of the audio data called back by the SDK in the APIs related to custom audio callback.
Properties | |
TRTCAudioSampleRate | sampleRate |
int | channels |
int | samplesPerCall |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
|
readwritenonatomicassign |
class TRTCScreenCaptureSourceInfo |
Screen sharing target information (for desktop systems only)
When users share the screen, they can choose to share the entire desktop or only the window of a certain program. TRTCScreenCaptureSourceInfo
is used to describe the information of the target to be shared, including ID, name, and thumbnail. The fields in this structure are read-only.
class TRTCAudioParallelParams |
parameter of the parallel strategy of remote audio streams
This parameter is used to set the parallel strategy of remote audio streams.
Properties | |
UInt32 | maxCount |
NSArray< NSString * > * | includeUsers |
|
readwritenonatomicstrong |
|
readwritenonatomicassign |
typedef TXMediaDeviceInfo TRTCMediaDeviceInfo |
typedef NSEdgeInsets TXEdgeInsets |
typedef NSImage TXImage |
typedef NSView TXView |
[VIEW] Rendering control that renders the video image
There are many APIs in TRTC that need to manipulate the video image, for which you should specify the video rendering control.
UIView
as the video rendering control, and the SDK will draw the video image on the UIView
you provide.NSView
as the video rendering control, and the SDK will draw the video image on the NSView
you provide. Below is the sample code: UIView *videoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 360, 640)]; [self.view addSubview:videoView]; [trtcCloud startLocalPreview:YES view:_localView];
enum TRTCAppScene : NSInteger |
Use cases
TRTC features targeted optimizations for common audio/video application scenarios to meet the differentiated requirements in various verticals. The main scenarios can be divided into the following two categories:
LIVE
(audio + video) and VoiceChatRoom
(pure audio). In the live streaming scenario, users are divided into two roles: "anchor" and "audience". A single room can sustain up to 100,000 concurrent online users. This is suitable for live streaming to a large audience.VideoCall
(audio + video) and AudioCall
(pure audio). In the real-time scenario, there is no role difference between users, but a single room can sustain only up to 300 concurrent online users. This is suitable for small-scale real-time communication. enum TRTCAudioQuality : NSInteger |
Sound quality
TRTC provides three well-tuned modes to meet the differentiated requirements for sound quality in various verticals:
Speech
and Music
. In this mode, the reproduction of music is better than that in Speech
mode, and the amount of transferred data is much lower than that in Music
mode; therefore, this mode has good adaptability to various scenarios. enum TRTCAudioRecordingContent : NSUInteger |
Audio recording content type
This enumerated type is used in the audio recording API startAudioRecording to specify the content of the recorded audio.
Enumerator | |
---|---|
TRTCAudioRecordingContentAll | Record both local and remote audio. |
TRTCAudioRecordingContentLocal | Record local audio only. |
TRTCAudioRecordingContentRemote | Record remote audio only. |
enum TRTCAudioRoute : NSInteger |
Audio route (i.e., audio playback mode)
"Audio route" determines whether the sound is played back from the speaker or receiver of a mobile device; therefore, this API is applicable only to mobile devices such as phones. Generally, a phone has two speakers: one is the receiver at the top, and the other is the stereo speaker at the bottom.
enum TRTCAudioSampleRate : NSInteger |
Audio sample rate
The audio sample rate is used to measure the audio fidelity. A higher sample rate indicates higher fidelity. If there is music in the use case, TRTCAudioSampleRate48000
is recommended.
Enumerator | |
---|---|
TRTCAudioSampleRate16000 | 16 kHz sample rate |
TRTCAudioSampleRate32000 | 32 kHz sample rate |
TRTCAudioSampleRate44100 | 44.1 kHz sample rate |
TRTCAudioSampleRate48000 | 48 kHz sample rate |
enum TRTCAVStatusChangeReason : NSUInteger |
Reasons for playback status changes
This enumerated type is used in the video status changed API onRemoteVideoStatusUpdated to specify the reason for the current video status change.
enum TRTCAVStatusType : NSUInteger |
Audio/Video playback status
This enumerated type is used in the video status changed API onRemoteVideoStatusUpdated to specify the current video status.
Enumerator | |
---|---|
TRTCAVStatusStopped | Stopped. |
TRTCAVStatusPlaying | Playing. |
TRTCAVStatusLoading | Loading. |
enum TRTCBeautyStyle : NSInteger |
Beauty (skin smoothing) filter algorithm
TRTC has multiple built-in skin smoothing algorithms. You can select the one most suitable for your product.
enum TRTCGSensorMode : NSInteger |
G-sensor switch (for mobile devices only)
enum TRTCLocalVideoMirrorType : NSUInteger |
enum TRTCLogLevel : NSInteger |
Log level
Different log levels indicate different levels of details and number of logs. We recommend you set the log level to TRTCLogLevelInfo
generally.
enum TRTCMediaDeviceType : NSInteger |
Device type (for desktop platforms only)
This enumerated value is used to define three types of audio/video devices, namely, camera, mic, and speaker, so that the same device management API can control the three different types of devices. Starting from v8.0, TRTC redefines TXMediaDeviceType
in TXDeviceManager
to replace TRTCMediaDeviceType
on legacy versions. Only the definition of TRTCMediaDeviceType
is retained here for compatibility with customer code on legacy versions.
enum TRTCMixInputType : NSUInteger |
Stream mix input type
enum TRTCQosControlMode : NSInteger |
enum TRTCQuality : NSInteger |
Network quality
TRTC evaluates the current network quality once every two seconds. The evaluation results are divided into six levels: Excellent
indicates the best, and Down
indicates the worst.
enum TRTCRecordType : NSUInteger |
Media recording type
This enumerated type is used in the local media recording API startLocalRecording to specify whether to record audio/video files or pure audio files.
Enumerator | |
---|---|
TRTCRecordTypeAudio | Record audio only. |
TRTCRecordTypeVideo | Record video only. |
TRTCRecordTypeBoth | Record both audio and video. |
enum TRTCReverbType : NSInteger |
Audio reverb mode
This enumerated value is used to set the audio reverb mode in the live streaming scenario and is often used in show live streaming.
enum TRTCRoleType : NSInteger |
Role
Role is applicable only to live streaming scenarios (TRTCAppSceneLIVE
and TRTCAppSceneVoiceChatRoom
). Users are divided into two roles:
Enumerator | |
---|---|
TRTCRoleAnchor | An anchor can publish their audio/video streams. There is a limit on the number of anchors. Up to 50 anchors are allowed to publish streams at the same time in one room. |
TRTCRoleAudience | Audience can only listen to or watch audio/video streams of anchors in the room. If they want to publish their streams, they need to switch to the "anchor" role first through switchRole. One room can sustain up to 100,000 concurrent online users in the audience role. |
enum TRTCScreenCaptureSourceType : NSInteger |
enum TRTCSnapshotSourceType : NSUInteger |
Data source of local video screenshot
The SDK can take screenshots from the following two data sources and save them as local files:
enum TRTCSystemVolumeType : NSInteger |
System volume type (only for mobile devices)
Smartphones usually have two types of system volume: call volume and media volume.
enum TRTCTranscodingConfigMode : NSInteger |
Layout mode of On-Cloud MixTranscoding
TRTC's On-Cloud MixTranscoding service can mix multiple audio/video streams in the room into one stream. Therefore, you need to specify the layout scheme of the video images. The following layout modes are provided:
enum TRTCVideoBufferType : NSInteger |
Video data transfer method
For custom capturing and rendering features, you need to use the following enumerated values to specify the method of transferring video data:
enum TRTCVideoFillMode : NSInteger |
Video image fill mode
If the aspect ratio of the video display area is not equal to that of the video image, you need to specify the fill mode:
enum TRTCVideoMirrorType : NSUInteger |
Video mirror type
Video mirroring refers to the left-to-right flipping of the video image, especially for the local camera preview image. After mirroring is enabled, it can bring anchors a familiar "look into the mirror" experience.
enum TRTCVideoPixelFormat : NSInteger |
Video pixel format
TRTC provides custom video capturing and rendering features.
enum TRTCVideoQosPreference : NSInteger |
Image quality preference
TRTC has two control modes in weak network environments: "ensuring clarity" and "ensuring smoothness". Both modes will give priority to the transfer of audio data.
enum TRTCVideoResolution : NSInteger |
Video resolution
Here, only the landscape resolution (e.g., 640x360) is defined. If the portrait resolution (e.g., 360x640) needs to be used, Portrait
must be selected for TRTCVideoResolutionMode
.
enum TRTCVideoResolutionMode : NSInteger |
Video aspect ratio mode
Only the landscape resolution (e.g., 640x360) is defined in TRTCVideoResolution
. If the portrait resolution (e.g., 360x640) needs to be used, Portrait
must be selected for TRTCVideoResolutionMode
.
enum TRTCVideoRotation : NSInteger |
Video image rotation direction
TRTC provides rotation angle setting APIs for local and remote images. The following rotation angles are all clockwise.
enum TRTCVideoStreamType : NSInteger |
Video stream type
TRTC provides three different video streams, including:
enum TRTCVoiceChangerType : NSInteger |
Voice changing type
This enumerated value is used to set the voice changing mode in the live streaming scenario and is often used in show live streaming.