LiteAVSDK
Tencent Cloud TRTC SDK, is a high availability components serving tens of thousands of enterprise customers, which is committed to helping you to minimize your research and development costs.
TRTCCloud

Detailed Description

Tencent Cloud TRTC Core Function Interface.

Module: TRTCCloud @ TXLiteAVSDK Function: TRTC's main feature API Version: <:Version:>


Data Structure Documentation

◆ TRTCCloud

class TRTCCloud

Instance Methods

(instancetype) - init
 

Class Methods

(instancetype) + new
 

Create Instance And Event Callback

id< TRTCCloudDelegatedelegate
 
dispatch_queue_t delegateQueue
 
(instancetype) + sharedInstance
 
(void) + destroySharedIntance
 

Room APIs

(void) - enterRoom:appScene:
 
(void) - exitRoom
 
(void) - switchRole:
 
(void) - switchRoom:
 
(void) - connectOtherRoom:
 
(void) - disconnectOtherRoom
 
(void) - setDefaultStreamRecvMode:video:
 
(TRTCCloud *) - createSubCloud
 
(void) - destroySubCloud:
 
(void) - startPublishing:type:
 
(void) - stopPublishing
 
(void) - startPublishCDNStream:
 
(void) - stopPublishCDNStream
 
(void) - setMixTranscodingConfig:
 

Video APIs

(void) - startLocalPreview:view:
 
(void) - startLocalPreview:
 
(void) - updateLocalView:
 
(void) - stopLocalPreview
 
(void) - muteLocalVideo:mute:
 
(void) - setVideoMuteImage:fps:
 
(void) - startRemoteView:streamType:view:
 
(void) - updateRemoteView:streamType:forUser:
 
(void) - stopRemoteView:streamType:
 
(void) - stopAllRemoteView
 
(void) - muteRemoteVideoStream:streamType:mute:
 
(void) - muteAllRemoteVideoStreams:
 
(void) - setVideoEncoderParam:
 
(void) - setNetworkQosParam:
 
(void) - setLocalRenderParams:
 
(void) - setRemoteRenderParams:streamType:params:
 
(void) - setVideoEncoderRotation:
 
(void) - setVideoEncoderMirror:
 
(void) - setGSensorMode:
 
(int) - enableEncSmallVideoStream:withQuality:
 
(void) - setRemoteVideoStreamType:type:
 
(void) - snapshotVideo:type:sourceType:completionBlock:
 

Audio APIs

(void) - startLocalAudio:
 
(void) - stopLocalAudio
 
(void) - muteLocalAudio:
 
(void) - muteRemoteAudio:mute:
 
(void) - muteAllRemoteAudio:
 
(void) - setAudioRoute:
 
(void) - setRemoteAudioVolume:volume:
 
(void) - setAudioCaptureVolume:
 
(NSInteger) - getAudioCaptureVolume
 
(void) - setAudioPlayoutVolume:
 
(NSInteger) - getAudioPlayoutVolume
 
(void) - enableAudioVolumeEvaluation:
 
(int) - startAudioRecording:
 
(void) - stopAudioRecording
 
(void) - startLocalRecording:
 
(void) - stopLocalRecording
 

Device management APIs

(TXDeviceManager *) - getDeviceManager
 

Beauty filter and watermark APIs

(TXBeautyManager *) - getBeautyManager
 
(void) - setWatermark:streamType:rect:
 

Background music and sound effect APIs

(TXAudioEffectManager *) - getAudioEffectManager
 
(void) - startSystemAudioLoopback
 
(void) - stopSystemAudioLoopback
 
(void) - setSystemAudioLoopbackVolume:
 

Screen sharing APIs

(void) - startScreenCaptureInApp:encParam:
 
(void) - startScreenCaptureByReplaykit:encParam:appGroup:
 
(void) - startScreenCapture:streamType:encParam:
 
(int) - stopScreenCapture
 
(int) - pauseScreenCapture
 
(int) - resumeScreenCapture
 
(NSArray< TRTCScreenCaptureSourceInfo * > *) - getScreenCaptureSourcesWithThumbnailSize:iconSize:
 
(void) - selectScreenCaptureTarget:rect:capturesCursor:highlight:
 
(void) - setSubStreamEncoderParam:
 
(void) - setSubStreamMixVolume:
 
(void) - addExcludedShareWindow:
 
(void) - removeExcludedShareWindow:
 
(void) - removeAllExcludedShareWindows
 
(void) - addIncludedShareWindow:
 
(void) - removeIncludedShareWindow:
 
(void) - removeAllIncludedShareWindows
 

Custom capturing and rendering APIs

(uint64_t) + generateCustomPTS
 
(void) - enableCustomVideoCapture:enable:
 
(void) - sendCustomVideoData:frame:
 
(void) - enableCustomAudioCapture:
 
(void) - sendCustomAudioData:
 
(void) - enableMixExternalAudioFrame:playout:
 
(int) - mixExternalAudioFrame:
 
(void) - setMixExternalAudioVolume:playoutVolume:
 
(int) - setLocalVideoProcessDelegete:pixelFormat:bufferType:
 
(int) - setLocalVideoRenderDelegate:pixelFormat:bufferType:
 
(int) - setRemoteVideoRenderDelegate:delegate:pixelFormat:bufferType:
 
(void) - setAudioFrameDelegate:
 
(int) - setCapturedRawAudioFrameDelegateFormat:
 
(int) - setLocalProcessedAudioFrameDelegateFormat:
 
(int) - setMixedPlayAudioFrameDelegateFormat:
 
(void) - enableCustomAudioRendering:
 
(void) - getCustomAudioRenderingFrame:
 

Custom message sending APIs

(BOOL) - sendCustomCmdMsg:data:reliable:ordered:
 
(BOOL) - sendSEIMsg:repeatCount:
 

Network test APIs

(void) - startSpeedTest:userId:userSig:completion:
 
(void) - stopSpeedTest
 

Debugging APIs

(NSString *) + getSDKVersion
 
(void) + setLogLevel:
 
(void) + setConsoleEnabled:
 
(void) + setLogCompressEnabled:
 
(void) + setLogDirPath:
 
(void) + setLogDelegate:
 
(void) - showDebugView:
 
(void) - setDebugViewMargin:margin:
 
(void) - callExperimentalAPI:
 

Disused APIs (the corresponding new APIs are recommended)

(void) - setMicVolumeOnMixing:
 
(void) - setBeautyStyle:beautyLevel:whitenessLevel:ruddinessLevel:
 
(void) - setEyeScaleLevel:
 
(void) - setFaceScaleLevel:
 
(void) - setFaceVLevel:
 
(void) - setChinLevel:
 
(void) - setFaceShortLevel:
 
(void) - setNoseSlimLevel:
 
(void) - selectMotionTmpl:
 
(void) - setMotionMute:
 
(void) - startScreenCapture:
 
(void) - setFilter:
 
(void) - setFilterConcentration:
 
(void) - setGreenScreenFile:
 
(void) - playBGM:withBeginNotify:withProgressNotify:andCompleteNotify:
 
(void) - stopBGM
 
(void) - pauseBGM
 
(void) - resumeBGM
 
(NSInteger) - getBGMDuration:
 
(int) - setBGMPosition:
 
(void) - setBGMVolume:
 
(void) - setBGMPlayoutVolume:
 
(void) - setBGMPublishVolume:
 
(void) - setReverbType:
 
(void) - setVoiceChangerType:
 
(void) - playAudioEffect:
 
(void) - setAudioEffectVolume:volume:
 
(void) - stopAudioEffect:
 
(void) - stopAllAudioEffects
 
(void) - setAllAudioEffectsVolume:
 
(void) - pauseAudioEffect:
 
(void) - resumeAudioEffect:
 
(void) - enableAudioEarMonitoring:
 
(void) - startRemoteView:view:
 
(void) - stopRemoteView:
 
(void) - setRemoteViewFillMode:mode:
 
(void) - setRemoteViewRotation:rotation:
 
(void) - setLocalViewFillMode:
 
(void) - setLocalViewRotation:
 
(void) - setLocalViewMirror:
 
(void) - setLocalViewMirror:
 
(void) - startRemoteSubStreamView:view:
 
(void) - stopRemoteSubStreamView:
 
(void) - setRemoteSubStreamViewFillMode:mode:
 
(void) - setRemoteSubStreamViewRotation:rotation:
 
(void) - setPriorRemoteVideoStreamType:
 
(void) - setAudioQuality:
 
(void) - startLocalAudio
 
(void) - switchCamera
 
(BOOL) - isCameraZoomSupported
 
(void) - setZoom:
 
(BOOL) - isCameraTorchSupported
 
(BOOL) - enbaleTorch:
 
(BOOL) - isCameraFocusPositionInPreviewSupported
 
(void) - setFocusPosition:
 
(BOOL) - isCameraAutoFocusFaceModeSupported
 
(void) - enableAutoFaceFoucs:
 
(void) - startCameraDeviceTestInView:
 
(void) - stopCameraDeviceTest
 
(void) - startMicDeviceTest:testEcho:
 
(void) - stopMicDeviceTest
 
(void) - startSpeakerDeviceTest:onVolumeChanged:
 
(void) - stopSpeakerDeviceTest
 
(NSArray< TRTCMediaDeviceInfo * > *) - getMicDevicesList
 
(TRTCMediaDeviceInfo *) - getCurrentMicDevice
 
(int) - setCurrentMicDevice:
 
(float) - getCurrentMicDeviceVolume
 
(void) - setCurrentMicDeviceVolume:
 
(BOOL) - getCurrentMicDeviceMute
 
(void) - setCurrentMicDeviceMute:
 
(NSArray< TRTCMediaDeviceInfo * > *) - getSpeakerDevicesList
 
(TRTCMediaDeviceInfo *) - getCurrentSpeakerDevice
 
(int) - setCurrentSpeakerDevice:
 
(float) - getCurrentSpeakerDeviceVolume
 
(int) - setCurrentSpeakerDeviceVolume:
 
(BOOL) - getCurrentSpeakerDeviceMute
 
(void) - setCurrentSpeakerDeviceMute:
 
(NSArray< TRTCMediaDeviceInfo * > *) - getCameraDevicesList
 
(TRTCMediaDeviceInfo *) - getCurrentCameraDevice
 
(int) - setCurrentCameraDevice:
 
(void) - setSystemVolumeType:
 
(void) - snapshotVideo:type:completionBlock:
 
(void) - enableCustomVideoCapture:
 
(void) - sendCustomVideoData:
 
(void) - startScreenCaptureInApp:
 
(void) - startScreenCaptureByReplaykit:appGroup:
 
(void) - muteLocalVideo:
 
(void) - muteRemoteVideoStream:mute:
 

Method Documentation

◆ addExcludedShareWindow:()

- (void) addExcludedShareWindow: (NSInteger)  windowID

Add specified windows to the exclusion list of screen sharing (for desktop systems only)

The excluded windows will not be shared. This feature is generally used to add a certain application's window to the exclusion list to avoid privacy issues. You can set the filtered windows before starting screen sharing or dynamically add the filtered windows during screen sharing.

Parameters
windowWindow not to be shared
Attention
  1. This API takes effect only if the type in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeScreen; that is, the feature of excluding specified windows works only when the entire screen is shared.
  2. The windows added to the exclusion list through this API will be automatically cleared by the SDK after room exit.
  3. On macOS, please pass in the window ID (CGWindowID), which can be obtained through the sourceId member in TRTCScreenCaptureSourceInfo.

◆ addIncludedShareWindow:()

- (void) addIncludedShareWindow: (NSInteger)  windowID

Add specified windows to the inclusion list of screen sharing (for desktop systems only)

This API takes effect only if the type in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeWindow; that is, the feature of additionally including specified windows works only when a window is shared. You can call it before or after startScreenCapture.

Parameters
windowIDWindow to be shared (which is a window handle HWND on Windows)
Attention
The windows added to the inclusion list by this method will be automatically cleared by the SDK after room exit.

◆ callExperimentalAPI:()

- (void) callExperimentalAPI: (NSString *)  jsonStr

Call experimental APIs

◆ connectOtherRoom:()

- (void) connectOtherRoom: (NSString *)  param

Request cross-room call

By default, only users in the same room can make audio/video calls with each other, and the audio/video streams in different rooms are isolated from each other. However, you can publish the audio/video streams of an anchor in another room to the current room by calling this API. At the same time, this API will also publish the local audio/video streams to the target anchor's room. In other words, you can use this API to share the audio/video streams of two anchors in two different rooms, so that the audience in each room can watch the streams of these two anchors. This feature can be used to implement anchor competition. The result of requesting cross-room call will be returned through the onConnectOtherRoom() callback in TRTCCloudDelegate. For example, after anchor A in room "101" uses connectOtherRoom() to successfully call anchor B in room "102":

  • All users in room "101" will receive the onRemoteUserEnterRoom(B) and onUserVideoAvailable(B,YES) event callbacks of anchor B; that is, all users in room "101" can subscribe to the audio/video streams of anchor B.
  • All users in room "102" will receive the onRemoteUserEnterRoom(A) and onUserVideoAvailable(A,YES) event callbacks of anchor A; that is, all users in room "102" can subscribe to the audio/video streams of anchor A.

                                      Room 101                          Room 102
                                ---------------------               ---------------------
     Before cross-room call:   | Anchor:     A       |             | Anchor:     B       |
                               | Users :   U, V, W   |             | Users:   X, Y, Z    |
                                ---------------------               ---------------------
                                      Room 101                           Room 102
                                ---------------------               ---------------------
     After cross-room call:    | Anchors: A and B    |             | Anchors: B and A    |
                               | Users  : U, V, W    |             | Users  : X, Y, Z    |
                                ---------------------               ---------------------
    

    For compatibility with subsequent extended fields for cross-room call, parameters in JSON format are used currently. Case 1: numeric room ID If anchor A in room "101" wants to co-anchor with anchor B in room "102", then anchor A needs to pass in {"roomId": 102, "userId": "userB"} when calling this API. Below is the sample code:

      NSMutableDictionaryjsonDict = [[NSMutableDictionary alloc] init];
      [jsonDict setObject:@(102) forKey:"roomId"];
      [jsonDict setObject:@"userB" forKey:@"userId"];
      NSData* jsonData = [NSJSONSerialization dataWithJSONObject:jsonDict options:NSJSONWritingPrettyPrinted error:nil];
      NSString* jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
      [trtc connectOtherRoom:jsonString];
    

Case 2: string room ID If you use a string room ID, please be sure to replace the roomId in JSON with strRoomId, such as {"strRoomId": "102", "userId": "userB"} Below is the sample code:

  NSMutableDictionaryjsonDict = [[NSMutableDictionary alloc] init];
  [jsonDict setObject:"102" forKey:@"strRoomId"];
  [jsonDict setObject:@"userB" forKey:@"userId"];
  NSData* jsonData = [NSJSONSerialization dataWithJSONObject:jsonDict options:NSJSONWritingPrettyPrinted error:nil];
  NSString* jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
  [trtc connectOtherRoom:jsonString];
Parameters
paramYou need to pass in a string parameter in JSON format: roomId represents the room ID in numeric format, strRoomId represents the room ID in string format, and userId represents the user ID of the target anchor.

◆ createSubCloud()

- (TRTCCloud *) createSubCloud

Create room subinstance (for concurrent multi-room listen/watch)

TRTCCloud was originally designed to work in the singleton mode, which limited the ability to watch concurrently in multiple rooms. By calling this API, you can create multiple TRTCCloud instances, so that you can enter multiple different rooms at the same time to listen/watch audio/video streams. However, it should be noted that because there are still only one camera and one mic available, you can exist as an "anchor" in only one TRTCCloud instance at any time; that is, you can only publish your audio/video streams in one TRTCCloud instance at any time. This feature is mainly used in the "super small class" use case in the online education scenario to break the limit that "only up to 50 users can publish their audio/video streams simultaneously in one TRTC room". Below is the sample code:

 TRTCCloud *mainCloud = [TRTCCloud sharedInstance]; [mainCloud enterRoom:params1 appScene:TRTCAppSceneLIVE)];
    //...
    //Switch the role from "anchor" to "audience" in your own room
    [mainCloud switchRole:TRTCRoleAudience];
    [mainCloud muteLocalVideo:true];
    [mainCloud muteLocalAudio:true];
    //...
    //Use subcloud to enter another room and switch the role from "audience" to "anchor"
    TRTCCloud *subCloud = [mainCloud createSubCloud];
    [subCloud enterRoom:params2 appScene:TRTCAppSceneLIVE)];
    [subCloud switchRole:TRTCRoleAnchor];
    [subCloud muteLocalVideo:false];
    [subCloud muteLocalAudio:false];
    //...
    //Exit from new room and release it.
    [subCloud exitRoom];
    [mainCloud destroySubCloud:subCloud];
Attention
  • The same user can enter multiple rooms with different roomId values by using the same userId.
  • Two devices cannot use the same userId to enter the same room with a specified roomId.
  • The same user can push a stream in only one TRTCCloud instance at any time. If streams are pushed simultaneously in different rooms, a status mess will be caused in the cloud, leading to various bugs.
  • The TRTCCloud instance created by the createSubCloud API cannot call APIs related to the local audio/video in the subinstance, except switchRole, muteLocalVideo, and muteLocalAudio. To use APIs such as the beauty filter, please use the original TRTCCloud instance object.
Returns
TRTCCloud subinstance

◆ destroySharedIntance()

+ (void) destroySharedIntance

Terminate TRTCCloud instance (singleton mode)

◆ destroySubCloud:()

- (void) destroySubCloud: (TRTCCloud *)  subCloud

Terminate room subinstance

Parameters
subCloud

◆ disconnectOtherRoom()

- (void) disconnectOtherRoom

Exit cross-room call

The result will be returned through the onDisconnectOtherRoom() callback in TRTCCloudDelegate.

◆ enableAudioEarMonitoring:()

- (void) enableAudioEarMonitoring: (BOOL)  enable

Enable or disable in-ear monitoring

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#setVoiceEarMonitor instead.

◆ enableAudioVolumeEvaluation:()

- (void) enableAudioVolumeEvaluation: (NSUInteger)  interval

Enable volume reminder

After this feature is enabled, the SDK will return the remote audio volume in the onUserVoiceVolume callback of TRTCCloudDelegate.

Attention
To enable this feature, call this API before calling startLocalAudio.
Parameters
intervalSet the interval in ms for triggering the onUserVoiceVolume callback. The minimum interval is 100 ms. If the value is smaller than or equal to 0, the callback will be disabled. We recommend you set this parameter to 300 ms.

◆ enableAutoFaceFoucs:()

- (void) enableAutoFaceFoucs: (BOOL)  enable

Enable/Disable face auto focus

Deprecated:
This API is not recommended after v8.0. Please use the enableCameraAutoFocus API in TXDeviceManager instead.

◆ enableCustomAudioCapture:()

- (void) enableCustomAudioCapture: (BOOL)  enable

Enable custom audio capturing mode

After this mode is enabled, the SDK will not run the original audio capturing process (i.e., stopping mic data capturing) and will retain only the audio encoding and sending capabilities. You need to use sendCustomAudioData to continuously insert the captured audio data into the SDK.

Parameters
enableWhether to enable. Default value: false
Attention
As acoustic echo cancellation (AEC) requires strict control over the audio capturing and playback time, after custom audio capturing is enabled, AEC may fail.

◆ enableCustomAudioRendering:()

- (void) enableCustomAudioRendering: (BOOL)  enable

Enabling custom audio playback

You can use this API to enable custom audio playback if you want to connect to an external audio device or control the audio playback logic by yourself. After you enable custom audio playback, the SDK will stop using its audio API to play back audio. You need to call getCustomAudioRenderingFrame to get audio frames and play them by yourself.

Parameters
enableWhether to enable custom audio playback. It’s disabled by default.
Attention
The parameter must be set before room entry to take effect.

◆ enableCustomVideoCapture:()

- (void) enableCustomVideoCapture: (BOOL)  enable

Enable custom video capturing mode

Deprecated:
This API is not recommended after v8.5. Please use enableCustomVideoCapture(streamType,enable) instead.

◆ enableCustomVideoCapture:enable:()

- (void) enableCustomVideoCapture: (TRTCVideoStreamType streamType
enable: (BOOL)  enable 

Enable/Disable custom video capturing mode

After this mode is enabled, the SDK will not run the original video capturing process (i.e., stopping camera data capturing and beauty filter operations) and will retain only the video encoding and sending capabilities. You need to use sendCustomVideoData to continuously insert the captured video image into the SDK.

Parameters
streamTypeSpecify video stream type (TRTCVideoStreamTypeBig: HD big image; TRTCVideoStreamTypeSub: substream image).
enableWhether to enable. Default value: false

◆ enableEncSmallVideoStream:withQuality:()

- (int) enableEncSmallVideoStream: (BOOL)  enable
withQuality: (TRTCVideoEncParam *)  smallVideoEncParam 

Enable dual-channel encoding mode with big and small images

In this mode, the current user's encoder will output two channels of video streams, i.e., HD big image and Smooth small image, at the same time (only one channel of audio stream will be output though). In this way, other users in the room can choose to subscribe to the HD big image or Smooth small image according to their own network conditions or screen size.

Attention
Dual-channel encoding will consume more CPU resources and network bandwidth; therefore, this feature can be enabled on macOS, Windows, or high-spec tablets, but is not recommended for phones.
Parameters
enableWhether to enable small image encoding. Default value: false
smallVideoEncParamVideo parameters of small image stream
Returns
0: success; -1: the current big image has been set to a lower quality, and it is not necessary to enable dual-channel encoding

◆ enableMixExternalAudioFrame:playout:()

- (void) enableMixExternalAudioFrame: (BOOL)  enablePublish
playout: (BOOL)  enablePlayout 

Enable/Disable custom audio track

After this feature is enabled, you can mix a custom audio track into the SDK through this API. With two boolean parameters, you can control whether to play back this track remotely or locally.

Parameters
enablePublishWhether the mixed audio track should be played back remotely. Default value: false
enablePlayoutWhether the mixed audio track should be played back locally. Default value: false
Attention
If you specify both enablePublish and enablePlayout as false, the custom audio track will be completely closed.

◆ enbaleTorch:()

- (BOOL) enbaleTorch: (BOOL)  enable

Enable/Disable flash

Deprecated:
This API is not recommended after v8.0. Please use the enableCameraTorch API in TXDeviceManager instead.

◆ enterRoom:appScene:()

- (void) enterRoom: (TRTCParams *)  param
appScene: (TRTCAppScene scene 

Enter room

All TRTC users need to enter a room before they can "publish" or "subscribe to" audio/video streams. "Publishing" refers to pushing their own streams to the cloud, and "subscribing to" refers to pulling the streams of other users in the room from the cloud. When calling this API, you need to specify your application scenario (TRTCAppScene) to get the best audio/video transfer experience. We provide the following four scenarios for your choice:

  • TRTCAppSceneVideoCall: Video call scenario. Use cases: [one-to-one video call], [video conferencing with up to 300 participants], [online medical diagnosis], [small class], [video interview], etc. In this scenario, each room supports up to 300 concurrent online users, and up to 50 of them can speak simultaneously.
  • TRTCAppSceneAudioCall: Audio call scenario. Use cases: [one-to-one audio call], [audio conferencing with up to 300 participants], [audio chat], [online Werewolf], etc. In this scenario, each room supports up to 300 concurrent online users, and up to 50 of them can speak simultaneously.
  • TRTCAppSceneLIVE: Live streaming scenario. Use cases: [low-latency video live streaming], [interactive classroom for up to 100,000 participants], [live video competition], [video dating room], [remote training], [large-scale conferencing], etc. In this scenario, each room supports up to 100,000 concurrent online users, but you should specify the user roles: anchor (TRTCRoleAnchor) or audience (TRTCRoleAudience).
  • TRTCAppSceneVoiceChatRoom: Audio chat room scenario. Use cases: [Clubhouse], [online karaoke room], [music live room], [FM radio], etc. In this scenario, each room supports up to 100,000 concurrent online users, but you should specify the user roles: anchor (TRTCRoleAnchor) or audience (TRTCRoleAudience). After calling this API, you will receive the onEnterRoom(result) callback from TRTCCloudDelegate:
    • If room entry succeeded, the result parameter will be a positive number (result > 0), indicating the time in milliseconds (ms) between function call and room entry.
    • If room entry failed, the result parameter will be a negative number (result < 0), indicating the error code for room entry failure.
      Parameters
      paramRoom entry parameter, which is used to specify the user's identity, role, authentication credentials, and other information. For more information, please see TRTCParams.
      sceneApplication scenario, which is used to specify the use case. The same TRTCAppScene should be configured for all users in the same room.
      Attention
      1. If scene is specified as TRTCAppSceneLIVE or TRTCAppSceneVoiceChatRoom, you must use the role field in TRTCParams to specify the role of the current user in the room.
      2. The same scene should be configured for all users in the same room.
      3. Please try to ensure that enterRoom and exitRoom are used in pair; that is, please make sure that "the previous room is exited before the next room is entered"; otherwise, many issues may occur.

◆ exitRoom()

- (void) exitRoom

Exit room

Calling this API will allow the user to leave the current audio or video room and release the camera, mic, speaker, and other device resources. After resources are released, the SDK will use the onExitRoom() callback in TRTCCloudDelegate to notify you. If you need to call enterRoom again or switch to the SDK of another provider, we recommend you wait until you receive the onExitRoom() callback, so as to avoid the problem of the camera or mic being occupied.

◆ generateCustomPTS()

+ (uint64_t) generateCustomPTS

Generate custom capturing timestamp

This API is only suitable for the custom capturing mode and is used to solve the problem of out-of-sync audio/video caused by the inconsistency between the capturing time and delivery time of audio/video frames. When you call APIs such as sendCustomVideoData or sendCustomAudioData for custom video or audio capturing, please use this API as instructed below:

  1. First, when a video or audio frame is captured, call this API to get the corresponding PTS timestamp.
  2. Then, send the video or audio frame to the preprocessing module you use (such as a third-party beauty filter or sound effect component).
  3. When you actually call sendCustomVideoData or sendCustomAudioData for delivery, assign the PTS timestamp recorded when the frame was captured to the timestamp field in TRTCVideoFrame or TRTCAudioFrame.
Returns
Timestamp in ms

◆ getAudioCaptureVolume()

- (NSInteger) getAudioCaptureVolume

Get the capturing volume of local audio

◆ getAudioEffectManager()

- (TXAudioEffectManager *) getAudioEffectManager

Get sound effect management class (TXAudioEffectManager)

TXAudioEffectManager is a sound effect management API, through which you can implement the following features:

  • Background music: both online music and local music can be played back with various features such as speed adjustment, pitch adjustment, original voice, accompaniment, and loop.
  • In-ear monitoring: the sound captured by the mic is played back in the headphones in real time, which is generally used for music live streaming.
  • Reverb effect: karaoke room, small room, big hall, deep, resonant, and other effects.
  • Voice changing effect: young girl, middle-aged man, heavy metal, and other effects.
  • Short sound effect: short sound effect files such as applause and laughter are supported (for files less than 10 seconds in length, please set the isShortFile parameter to true).

◆ getAudioPlayoutVolume()

- (NSInteger) getAudioPlayoutVolume

Get the playback volume of remote audio

◆ getBeautyManager()

- (TXBeautyManager *) getBeautyManager

Get beauty filter management class (TXBeautyManager)

You can use the following features with beauty filter management:

  • Set beauty effects such as "skin smoothing", "brightening", and "rosy skin".
  • Set face adjustment effects such as "eye enlarging", "face slimming", "chin slimming", "chin lengthening/shortening", "face shortening", "nose narrowing", "eye brightening", "teeth whitening", "eye bag removal", "wrinkle removal", and "smile line removal".
  • Set face adjustment effects such as "hairline", "eye distance", "eye corners", "mouth shape", "nose wing", "nose position", "lip thickness", and "face shape".
  • Set makeup effects such as "eye shadow" and "blush".
  • Set animated effects such as animated sticker and facial pendant.

◆ getBGMDuration:()

- (NSInteger) getBGMDuration: (NSString *)  path

Get the total length of background music in ms

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#getMusicDurationInMS instead.

◆ getCameraDevicesList()

- (NSArray<TRTCMediaDeviceInfo *> *) getCameraDevicesList

Get the list of cameras

Deprecated:
This API is not recommended after v8.0. Please use the getDevicesList API in TXDeviceManager instead.

◆ getCurrentCameraDevice()

- (TRTCMediaDeviceInfo *) getCurrentCameraDevice

Get the currently used camera

Deprecated:
This API is not recommended after v8.0. Please use the getCurrentDevice API in TXDeviceManager instead.

◆ getCurrentMicDevice()

- (TRTCMediaDeviceInfo *) getCurrentMicDevice

Get the current mic device

Deprecated:
This API is not recommended after v8.0. Please use the getCurrentDevice API in TXDeviceManager instead.

◆ getCurrentMicDeviceMute()

- (BOOL) getCurrentMicDeviceMute

Get the mute status of the current system mic

Deprecated:
This API is not recommended after v8.0. Please use the getCurrentDeviceMute API in TXDeviceManager instead.

◆ getCurrentMicDeviceVolume()

- (float) getCurrentMicDeviceVolume

Get the current mic volume

Deprecated:
This API is not recommended after v8.0. Please use the getCurrentDeviceVolume API in TXDeviceManager instead.

◆ getCurrentSpeakerDevice()

- (TRTCMediaDeviceInfo *) getCurrentSpeakerDevice

Get the currently used speaker

Deprecated:
This API is not recommended after v8.0. Please use the getCurrentDevice API in TXDeviceManager instead.

◆ getCurrentSpeakerDeviceMute()

- (BOOL) getCurrentSpeakerDeviceMute

Get the mute status of the current system speaker

Deprecated:
This API is not recommended after v8.0. Please use the getCurrentDeviceMute API in TXDeviceManager instead.

◆ getCurrentSpeakerDeviceVolume()

- (float) getCurrentSpeakerDeviceVolume

Get the current speaker volume

Deprecated:
This API is not recommended after v8.0. Please use the getCurrentDeviceVolume API in TXDeviceManager instead.

◆ getCustomAudioRenderingFrame:()

- (void) getCustomAudioRenderingFrame: (TRTCAudioFrame *)  audioFrame

Getting playable audio data

Before calling this API, you need to first enable custom audio playback using enableCustomAudioRendering. Fill the fields in TRTCAudioFrame as follows (other fields are not required):

  • sampleRate: sample rate (required). Valid values: 16000, 24000, 32000, 44100, 48000
  • channel: number of sound channels (required). 1: mono-channel; 2: dual-channel; if dual-channel is used, data is interleaved.
  • data: the buffer used to get audio data. You need to allocate memory for the buffer based on the duration of an audio frame. The PCM data obtained can have a frame duration of 10 ms or 20 ms. 20 ms is recommended. Assume that the sample rate is 48000, and sound channels mono-channel. The buffer size for a 20 ms audio frame would be 48000 x 0.02s x 1 x 16 bit = 15360 bit = 1920 bytes.
Parameters
audioFrameAudio frames
Attention
  1. You must set sampleRate and channel in audioFrame, and allocate memory for one frame of audio in advance.
  2. The SDK will fill the data automatically based on sampleRate and channel.
  3. We recommend that you use the system’s audio playback thread to drive the calling of this API, so that it is called each time the playback of an audio frame is complete.

◆ getDeviceManager()

- (TXDeviceManager *) getDeviceManager

Get device management class (TXDeviceManager)

◆ getMicDevicesList()

- (NSArray<TRTCMediaDeviceInfo *> *) getMicDevicesList

Get the list of mics

Deprecated:
This API is not recommended after v8.0. Please use the getDevicesList API in TXDeviceManager instead.

◆ getScreenCaptureSourcesWithThumbnailSize:iconSize:()

- (NSArray<TRTCScreenCaptureSourceInfo *> *) getScreenCaptureSourcesWithThumbnailSize: (CGSize)  thumbnailSize
iconSize: (CGSize)  iconSize 

Enumerate shareable screens and windows (for macOS only)

When you integrate the screen sharing feature of a desktop system, you generally need to display a UI for selecting the sharing target, so that users can use the UI to choose whether to share the entire screen or a certain window. Through this API, you can query the IDs, names, and thumbnails of sharable windows on the current system. We provide a default UI implementation in the demo for your reference.

Attention
The returned list contains the screen and the application windows. The screen is the first element in the list. If the user has multiple displays, then each display is a sharing target.
Parameters
thumbnailSizeSpecify the thumbnail size of the window to be obtained. The thumbnail can be drawn on the window selection UI.
iconSizeSpecify the icon size of the window to be obtained.
Returns
List of windows (including the screen)

◆ getSDKVersion()

+ (NSString *) getSDKVersion

Get SDK version information

◆ getSpeakerDevicesList()

- (NSArray<TRTCMediaDeviceInfo *> *) getSpeakerDevicesList

Get the list of speakers

Deprecated:
This API is not recommended after v8.0. Please use the getDevicesList API in TXDeviceManager instead.

◆ init()

- (instancetype) init

◆ isCameraAutoFocusFaceModeSupported()

- (BOOL) isCameraAutoFocusFaceModeSupported

Query whether the device supports the automatic recognition of face position

Deprecated:
This API is not recommended after v8.0. Please use the isAutoFocusEnabled API in TXDeviceManager instead.

◆ isCameraFocusPositionInPreviewSupported()

- (BOOL) isCameraFocusPositionInPreviewSupported

Query whether the camera supports setting focus

Deprecated:
This API is not recommended after v8.0.

◆ isCameraTorchSupported()

- (BOOL) isCameraTorchSupported

Query whether the device supports flash

Deprecated:
This API is not recommended after v8.0. Please use the isCameraTorchSupported API in TXDeviceManager instead.

◆ isCameraZoomSupported()

- (BOOL) isCameraZoomSupported

Query whether the current camera supports zoom

Deprecated:
This API is not recommended after v8.0. Please use the isCameraZoomSupported API in TXDeviceManager instead.

◆ mixExternalAudioFrame:()

- (int) mixExternalAudioFrame: (TRTCAudioFrame *)  frame

Mix custom audio track into SDK

Before you use this API to mix custom PCM audio into the SDK, you need to first enable custom audio tracks through enableMixExternalAudioFrame. You are expected to feed audio data into the SDK at an even pace, but we understand that it can be challenging to call an API at absolutely regular intervals. Given this, we have provided a buffer pool in the SDK, which can cache the audio data you pass in to reduce the fluctuations in intervals between API calls. The value returned by this API indicates the size (ms) of the buffer pool. For example, if 50 is returned, it indicates that the buffer pool has 50 ms of audio data. As long as you call this API again within 50 ms, the SDK can make sure that continuous audio data is mixed. If the value returned is 100 or greater, you can wait after an audio frame is played to call the API again. If the value returned is smaller than 100, then there isn’t enough data in the buffer pool, and you should feed more audio data into the SDK until the data in the buffer pool is above the safety level. Fill the fields in TRTCAudioFrame as follows (other fields are not required).

  • data: audio frame buffer. Audio frames must be in PCM format. Each frame can be 5-100 ms (20 ms is recommended) in duration. Assume that the sample rate is 48000, and sound channels mono-channel. Then the frame size would be 48000 x 0.02s x 1 x 16 bit = 15360 bit = 1920 bytes.
  • sampleRate: sample rate. Valid values: 16000, 24000, 32000, 44100, 48000
  • channel: number of sound channels (if dual-channel is used, data is interleaved). Valid values: 1 (mono-channel); 2 (dual channel)
  • timestamp: timestamp (ms). Set it to the timestamp when audio frames are captured, which you can obtain by calling generateCustomPTS after getting an audio frame.
Parameters
frameAudio data
Returns
If the value returned is 0 or greater, the value represents the current size of the buffer pool; if the value returned is smaller than 0, it means that an error occurred. -1 indicates that you didn’t call {} to enable custom audio tracks.

◆ muteAllRemoteAudio:()

- (void) muteAllRemoteAudio: (BOOL)  mute

Pause/Resume playing back all remote users' audio streams

When you mute the audio of all remote users, the SDK will stop playing back all their audio streams and pulling all their audio data.

Parameters
mutetrue: mute; false: unmute
Attention
This API works when called either before or after room entry (enterRoom), and the mute status will be reset to false after room exit (exitRoom).

◆ muteAllRemoteVideoStreams:()

- (void) muteAllRemoteVideoStreams: (BOOL)  mute

Pause/Resume subscribing to all remote users' video streams

This API only pauses/resumes receiving all users' video streams but does not release displaying resources; therefore, the video image will freeze at the last frame before it is called.

Parameters
muteWhether to pause receiving
Attention
This API can be called before room entry (enterRoom), and the pause status will be reset after room exit (exitRoom).

◆ muteLocalAudio:()

- (void) muteLocalAudio: (BOOL)  mute

Pause/Resume publishing local audio stream

After local audio publishing is paused, other users in the room will receive the onUserAudioAvailable(userId, false) notification. After local audio publishing is resumed, other users in the room will receive the onUserAudioAvailable(userId, true) notification. Different from stopLocalAudio, muteLocalAudio(true) does not release the mic permission; instead, it continues to send mute packets with extremely low bitrate. This is very suitable for scenarios that require on-cloud recording, as video file formats such as MP4 have a high requirement for audio continuity, while an MP4 recording file cannot be played back smoothly if stopLocalAudio is used. Therefore, muteLocalAudio instead of stopLocalAudio is recommended in scenarios where the requirement for recording file quality is high.

Parameters
mutetrue: mute; false: unmute

◆ muteLocalVideo:()

- (void) muteLocalVideo: (BOOL)  mute

Pause/Resume publishing local video stream

Deprecated:
This API is not recommended after v8.9. Please use muteLocalVideo(streamType, mute) instead.

◆ muteLocalVideo:mute:()

- (void) muteLocalVideo: (TRTCVideoStreamType streamType
mute: (BOOL)  mute 

Pause/Resume publishing local video stream

This API can pause (or resume) publishing the local video image. After the pause, other users in the same room will not be able to see the local image. This API is equivalent to the two APIs of startLocalPreview/stopLocalPreview when TRTCVideoStreamTypeBig is specified, but has higher performance and response speed. The startLocalPreview/stopLocalPreview APIs need to enable/disable the camera, which are hardware device-related operations, so they are very time-consuming. In contrast, muteLocalVideo only needs to pause or allow the data stream at the software level, so it is more efficient and more suitable for scenarios where frequent enabling/disabling are needed. After local video publishing is paused, other members in the same room will receive the onUserVideoAvailable(userId, false) callback notification. After local video publishing is resumed, other members in the same room will receive the onUserVideoAvailable(userId, true) callback notification.

Parameters
streamTypeSpecify for which video stream to pause (or resume). Only TRTCVideoStreamTypeBig and TRTCVideoStreamTypeSub are supported
mutetrue: pause; false: resume

◆ muteRemoteAudio:mute:()

- (void) muteRemoteAudio: (NSString *)  userId
mute: (BOOL)  mute 

Pause/Resume playing back remote audio stream

When you mute the remote audio of a specified user, the SDK will stop playing back the user's audio and pulling the user's audio data.

Parameters
userIdID of the specified remote user
mutetrue: mute; false: unmute
Attention
This API works when called either before or after room entry (enterRoom), and the mute status will be reset to false after room exit (exitRoom).

◆ muteRemoteVideoStream:mute:()

- (void) muteRemoteVideoStream: (NSString *)  userId
mute: (BOOL)  mute 

Pause/Resume subscribing to remote user's video stream

Deprecated:
This API is not recommended after v8.9. Please use muteRemoteVideoStream(userId, streamType, mute) instead.

◆ muteRemoteVideoStream:streamType:mute:()

- (void) muteRemoteVideoStream: (NSString *)  userId
streamType: (TRTCVideoStreamType streamType
mute: (BOOL)  mute 

Pause/Resume subscribing to remote user's video stream

This API only pauses/resumes receiving the specified user's video stream but does not release displaying resources; therefore, the video image will freeze at the last frame before it is called.

Parameters
userIdID of the specified remote user
streamTypeSpecify for which video stream to pause (or resume). Only TRTCVideoStreamTypeBig and TRTCVideoStreamTypeSub are supported
muteWhether to pause receiving
Attention
This API can be called before room entry (enterRoom), and the pause status will be reset after room exit (exitRoom).

◆ new()

+ (instancetype) new

◆ pauseAudioEffect:()

- (void) pauseAudioEffect: (int)  effectId

Pause sound effect

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#pauseAudioEffect instead.

◆ pauseBGM()

- (void) pauseBGM

Stop background music

Deprecated:
This API is not recommended after v7.3. Please use getAudioEffectManager instead.

◆ pauseScreenCapture()

- (int) pauseScreenCapture

Pause screen sharing

◆ playAudioEffect:()

- (void) playAudioEffect: (TRTCAudioEffectParam *)  effect

Play sound effect

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#startPlayMusic instead.

◆ playBGM:withBeginNotify:withProgressNotify:andCompleteNotify:()

- (void) playBGM: (NSString *)  path
withBeginNotify: (void(^)(NSInteger errCode))  beginNotify
withProgressNotify: (void(^)(NSInteger progressMS, NSInteger durationMS))  progressNotify
andCompleteNotify: (void(^)(NSInteger errCode))  completeNotify 

Start background music

Deprecated:
This API is not recommended after v7.3. Please use getAudioEffectManager instead.

◆ removeAllExcludedShareWindows()

- (void) removeAllExcludedShareWindows

Remove all windows from the exclusion list of screen sharing (for desktop systems only)

◆ removeAllIncludedShareWindows()

- (void) removeAllIncludedShareWindows

Remove all windows from the inclusion list of screen sharing (for desktop systems only)

This API takes effect only if the type in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeWindow. That is, the feature of additionally including specified windows works only when a window is shared.

◆ removeExcludedShareWindow:()

- (void) removeExcludedShareWindow: (NSInteger)  windowID

Remove specified windows from the exclusion list of screen sharing (for desktop systems only)

Parameters
windowID

◆ removeIncludedShareWindow:()

- (void) removeIncludedShareWindow: (NSInteger)  windowID

Remove specified windows from the inclusion list of screen sharing (for desktop systems only)

This API takes effect only if the type in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeWindow. That is, the feature of additionally including specified windows works only when a window is shared.

Parameters
windowIDWindow to be shared (window ID on macOS or HWND on Windows)

◆ resumeAudioEffect:()

- (void) resumeAudioEffect: (int)  effectId

Pause sound effect

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#resumePlayMusic instead.

◆ resumeBGM()

- (void) resumeBGM

Stop background music

Deprecated:
This API is not recommended after v7.3. Please use getAudioEffectManager instead.

◆ resumeScreenCapture()

- (int) resumeScreenCapture

Resume screen sharing

◆ selectMotionTmpl:()

- (void) selectMotionTmpl: (NSString *)  tmplPath

Set animated sticker

Deprecated:
This API is not recommended after v6.9. Please use getBeautyManager instead.

◆ selectScreenCaptureTarget:rect:capturesCursor:highlight:()

- (void) selectScreenCaptureTarget: (TRTCScreenCaptureSourceInfo *)  screenSource
rect: (CGRect)  rect
capturesCursor: (BOOL)  capturesCursor
highlight: (BOOL)  highlight 

Select the screen or window to share (for macOS only)

After you get the sharable screen and windows through getScreenCaptureSources, you can call this API to select the target screen or window you want to share. During the screen sharing process, you can also call this API at any time to switch the sharing target.

Parameters
screenSourceSpecify sharing source
rectSpecify the area to be captured (set this parameter to CGRectZero: when the sharing target is a window, the entire window will be shared, and when the sharing target is the desktop, the entire desktop will be shared)
capturesCursorWhether to capture mouse cursor
highlightWhether to highlight the window being shared

◆ sendCustomAudioData:()

- (void) sendCustomAudioData: (TRTCAudioFrame *)  frame

Deliver captured audio data to SDK

We recommend you enter the following information for the TRTCAudioFrame parameter (other fields can be left empty):

  • audioFormat: audio data format, which can only be TRTCAudioFrameFormatPCM.
  • data: audio frame buffer. Audio frame data must be in PCM format, and it supports a frame length of 5–100 ms (20 ms is recommended). Length calculation method: for example, if the sample rate is 48000, then the frame length for mono channel will be 48000 *s * 1 * 16 bit = 15360 bit = 1920 bytes.
  • sampleRate: sample rate. Valid values: 16000, 24000, 32000, 44100, 48000.
  • channel: number of channels (if stereo is used, data is interwoven). Valid values: 1: mono channel; 2: dual channel.
  • timestamp (ms): Set it to the timestamp when audio frames are captured, which you can obtain by calling generateCustomPTS after getting a audio frame.

For more information, please see Custom Capturing and Rendering.

Parameters
frameAudio data
Attention
Please call this API accurately at intervals of the frame length; otherwise, sound lag may occur due to uneven data delivery intervals.

◆ sendCustomCmdMsg:data:reliable:ordered:()

- (BOOL) sendCustomCmdMsg: (NSInteger)  cmdID
data: (NSData *)  data
reliable: (BOOL)  reliable
ordered: (BOOL)  ordered 

Use UDP channel to send custom message to all users in room

This API allows you to use TRTC's UDP channel to broadcast custom data to other users in the current room for signaling transfer. The UDP channel in TRTC was originally designed to transfer audio/video data. This API works by disguising the signaling data you want to send as audio/video data packets and sending them together with the audio/video data to be sent. Other users in the room can receive the message through the onRecvCustomCmdMsg callback in TRTCCloudDelegate.

Parameters
cmdIDMessage ID. Value range: 1–10
dataMessage to be sent. The maximum length of one single message is 1 KB.
reliableWhether reliable sending is enabled. Reliable sending can achieve a higher success rate but with a longer reception delay than unreliable sending.
orderedWhether orderly sending is enabled, i.e., whether the data packets should be received in the same order in which they are sent; if so, a certain delay will be caused.
Returns
true: sent the message successfully; false: failed to send the message.
Attention
  1. Up to 30 messages can be sent per second to all users in the room (this is not supported for web and mini program currently).
  2. A packet can contain up to 1 KB of data; if the threshold is exceeded, the packet is very likely to be discarded by the intermediate router or server.
  3. A client can send up to 8 KB of data in total per second.
  4. reliable and ordered must be set to the same value (true or false) and cannot be set to different values currently.
  5. We strongly recommend you set different cmdID values for messages of different types. This can reduce message delay when orderly sending is required.

◆ sendCustomVideoData:()

- (void) sendCustomVideoData: (TRTCVideoFrame *)  frame

Deliver captured video data to SDK

Deprecated:
This API is not recommended after v8.5. Please use sendCustomVideoData(streamType, TRTCVideoFrame) instead.

◆ sendCustomVideoData:frame:()

- (void) sendCustomVideoData: (TRTCVideoStreamType streamType
frame: (TRTCVideoFrame *)  frame 

Deliver captured video frames to SDK

You can use this API to deliver video frames you capture to the SDK, and the SDK will encode and transfer them through its own network module. We recommend you enter the following information for the TRTCVideoFrame parameter (other fields can be left empty):

  • pixelFormat: TRTCVideoPixelFormat_NV12 is recommended.
  • bufferType: TRTCVideoBufferType_PixelBuffer is recommended.
  • pixelBuffer: common video data format on iOS/macOS.
  • data: raw video data format, which is used if bufferType is NSData.
  • timestamp (ms): Set it to the timestamp when video frames are captured, which you can obtain by calling generateCustomPTS after getting a video frame.
  • width: video image length, which needs to be set if bufferType is NSData.
  • height: video image width, which needs to be set if bufferType is NSData.

For more information, please see Custom Capturing and Rendering.

Parameters
streamTypeSpecify video stream type (TRTCVideoStreamTypeBig: HD big image; TRTCVideoStreamTypeSub: substream image).
frameVideo data, which can be in PixelBuffer NV12, BGRA, or I420 format.
Attention
  1. We recommend you call the generateCustomPTS API to get the timestamp value of a video frame immediately after capturing it, so as to achieve the best audio/video sync effect.
  2. The video frame rate eventually encoded by the SDK is not determined by the frequency at which you call this API, but by the FPS you set in setVideoEncoderParam.
  3. Please try to keep the calling interval of this API even; otherwise, problems will occur, such as unstable output frame rate of the encoder or out-of-sync audio/video.

◆ sendSEIMsg:repeatCount:()

- (BOOL) sendSEIMsg: (NSData *)  data
repeatCount: (int)  repeatCount 

Use SEI channel to send custom message to all users in room

This API allows you to use TRTC's SEI channel to broadcast custom data to other users in the current room for signaling transfer. The header of a video frame has a header data block called SEI. This API works by embedding the custom signaling data you want to send in the SEI block and sending it together with the video frame. Therefore, the SEI channel has a better compatibility than sendCustomCmdMsg as the signaling data can be transferred to the CSS CDN along with the video frame. However, because the data block of the video 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. The most common use is to embed the custom timestamp into video frames through this API so as to implement a perfect alignment between the message and video image (such as between the teaching material and video signal in the education scenario). Other users in the room can receive the message through the onRecvSEIMsg callback in TRTCCloudDelegate.

Parameters
dataData to be sent, which can be up to 1 KB (1,000 bytes)
repeatCountData sending count
Returns
YES: the message is allowed and will be sent with subsequent video frames; NO: the message is not allowed to be sent
Attention
This API has the following restrictions:
  1. The data will not be instantly sent after this API is called; instead, it will be inserted into the next video frame after the API call.
  2. Up to 30 messages can be sent per second to all users in the room (this limit is shared with sendCustomCmdMsg).
  3. Each packet can be up to 1 KB (this limit is shared with sendCustomCmdMsg). If a large amount of data is sent, the video bitrate will increase, which may reduce the video quality or even cause lagging.
  4. Each client can send up to 8 KB of data in total per second (this limit is shared with sendCustomCmdMsg).
  5. If multiple times of sending is required (i.e., repeatCount > 1), the data will be inserted into subsequent repeatCount video frames in a row for sending, which will increase the video bitrate.
  6. If repeatCount is greater than 1, the data will be sent for multiple times, and the same message may be received multiple times in the onRecvSEIMsg callback; therefore, deduplication is required.

◆ setAllAudioEffectsVolume:()

- (void) setAllAudioEffectsVolume: (int)  volume

Set the volume of all sound effects

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#setMusicPublishVolume and TXAudioEffectManager#setMusicPlayoutVolume instead.

◆ setAudioCaptureVolume:()

- (void) setAudioCaptureVolume: (NSInteger)  volume

Set the capturing volume of local audio

Parameters
volumeVolume. 100 is the original volume. Value range: [0,150]. Default value: 100
Attention
If 100 is still not loud enough for you, you can set the volume to up to 150, but there may be side effects.

◆ setAudioEffectVolume:volume:()

- (void) setAudioEffectVolume: (int)  effectId
volume: (int)  volume 

Set sound effect volume

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#setMusicPublishVolume and TXAudioEffectManager#setMusicPlayoutVolume instead.

◆ setAudioFrameDelegate:()

- (void) setAudioFrameDelegate: (id< TRTCAudioFrameDelegate >)  delegate

Set custom audio data callback

After this callback is set, the SDK will internally call back the audio data (in PCM format), including:

Attention
Setting the callback to null indicates to stop the custom audio callback, while setting it to a non-null value indicates to start the custom audio callback.

◆ setAudioPlayoutVolume:()

- (void) setAudioPlayoutVolume: (NSInteger)  volume

Set the playback volume of remote audio

This API controls the volume of the sound ultimately delivered by the SDK to the system for playback. It affects the volume of the recorded local audio file but not the volume of in-ear monitoring.

Parameters
volumeVolume. 100 is the original volume. Value range: [0,150]. Default value: 100
Attention
If 100 is still not loud enough for you, you can set the volume to up to 150, but there may be side effects.

◆ setAudioQuality:()

- (void) setAudioQuality: (TRTCAudioQuality quality

Set sound quality

Deprecated:
This API is not recommended after v8.0. Please use startLocalAudio:(quality) instead.

◆ setAudioRoute:()

- (void) setAudioRoute: (TRTCAudioRoute route

Set audio route

Setting "audio route" is to determine whether the sound is played back from the speaker or receiver of a mobile device; therefore, this API is only applicable 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. If audio route is set to the receiver, the volume is relatively low, and the sound can be heard clearly only when the phone is put near the ear. This mode has a high level of privacy and is suitable for answering calls. If audio route is set to the speaker, the volume is relatively high, so there is no need to put the phone near the ear. Therefore, this mode can implement the "hands-free" feature.

Parameters
routeAudio route, i.e., whether the audio is output by speaker or receiver. Default value: TRTCAudioModeSpeakerphone

◆ setBeautyStyle:beautyLevel:whitenessLevel:ruddinessLevel:()

- (void) setBeautyStyle: (TRTCBeautyStyle beautyStyle
beautyLevel: (NSInteger)  beautyLevel
whitenessLevel: (NSInteger)  whitenessLevel
ruddinessLevel: (NSInteger)  ruddinessLevel 

Set the strength of beauty, brightening, and rosy skin filters

Deprecated:
This API is not recommended after v6.9. Please use getBeautyManager instead.

◆ setBGMPlayoutVolume:()

- (void) setBGMPlayoutVolume: (NSInteger)  volume

Set the local playback volume of background music

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#setMusicPlayoutVolume instead.

◆ setBGMPosition:()

- (int) setBGMPosition: (NSInteger)  pos

Set background music playback progress

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#seekMusicToPosInMS instead.

◆ setBGMPublishVolume:()

- (void) setBGMPublishVolume: (NSInteger)  volume

Set the remote playback volume of background music

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#setBGMPublishVolume instead.

◆ setBGMVolume:()

- (void) setBGMVolume: (NSInteger)  volume

Set background music volume

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#setMusicVolume instead.

◆ setCapturedRawAudioFrameDelegateFormat:()

- (int) setCapturedRawAudioFrameDelegateFormat: (TRTCAudioFrameDelegateFormat *)  format

Set the callback format of original audio frames captured by local mic

This API is used to set the AudioFrame format called back by onCapturedRawAudioFrame:

  • sampleRate: sample rate. Valid values: 16000, 32000, 44100, 48000
  • channel: number of channels (if stereo is used, data is interwoven). Valid values: 1: mono channel; 2: dual channel
  • samplesPerCall: number of sample points, which defines the frame length of the callback data. The frame length must be an integer multiple of 10 ms.

If you want to calculate the callback frame length in milliseconds, the formula for converting the number of milliseconds into the number of sample points is as follows: number of sample points = number of milliseconds * sample rate / 1000 For example, if you want to call back the data of 20 ms frame length with 48000 sample rate, then the number of sample points should be entered as 960 = 20 * 48000 / 1000 Note that the frame length of the final callback is in bytes, and the calculation formula for converting the number of sample points into the number of bytes is as follows: number of bytes = number of sample points * number of channels * 2 (bit width) For example, if the parameters are 48000 sample rate, dual channel, 20 ms frame length, and 960 sample points, then the number of bytes is 3840 = 960 * 2 * 2

Parameters
formatAudio data callback format
Returns
0: success; values smaller than 0: error

◆ setChinLevel:()

- (void) setChinLevel: (float)  chinLevel

Set the strength of chin lengthening/shortening filter

Deprecated:
This API is not recommended after v6.9. Please use getBeautyManager instead.

◆ setConsoleEnabled:()

+ (void) setConsoleEnabled: (BOOL)  enabled

Enable/Disable console log printing

Parameters
enabledSpecify whether to enable it, which is disabled by default

◆ setCurrentCameraDevice:()

- (int) setCurrentCameraDevice: (NSString *)  deviceId

Set the camera to be used currently

Deprecated:
This API is not recommended after v8.0. Please use the setCurrentDevice API in TXDeviceManager instead.

◆ setCurrentMicDevice:()

- (int) setCurrentMicDevice: (NSString *)  deviceId

Select the currently used mic

Deprecated:
This API is not recommended after v8.0. Please use the setCurrentDevice API in TXDeviceManager instead.

◆ setCurrentMicDeviceMute:()

- (void) setCurrentMicDeviceMute: (BOOL)  mute

Set the mute status of the current system mic

Deprecated:
This API is not recommended after v8.0. Please use the setCurrentDeviceMute API in TXDeviceManager instead.

◆ setCurrentMicDeviceVolume:()

- (void) setCurrentMicDeviceVolume: (NSInteger)  volume

Set the current mic volume

Deprecated:
This API is not recommended after v8.0. Please use the setCurrentDeviceVolume API in TXDeviceManager instead.

◆ setCurrentSpeakerDevice:()

- (int) setCurrentSpeakerDevice: (NSString *)  deviceId

Set the speaker to use

Deprecated:
This API is not recommended after v8.0. Please use the setCurrentDevice API in TXDeviceManager instead.

◆ setCurrentSpeakerDeviceMute:()

- (void) setCurrentSpeakerDeviceMute: (BOOL)  mute

Set whether to mute the current system speaker

Deprecated:
This API is not recommended after v8.0. Please use the setCurrentDeviceMute API in TXDeviceManager instead.

◆ setCurrentSpeakerDeviceVolume:()

- (int) setCurrentSpeakerDeviceVolume: (NSInteger)  volume

Set the current speaker volume

Deprecated:
This API is not recommended after v8.0. Please use the setCurrentDeviceVolume API in TXDeviceManager instead.

◆ setDebugViewMargin:margin:()

- (void) setDebugViewMargin: (NSString *)  userId
margin: (TXEdgeInsets margin 

Set dashboard margin

This API is used to adjust the position of the dashboard in the video rendering control. It must be called before showDebugView for it to take effect.

Parameters
userIdUser ID
marginInner margin of the dashboard. It should be noted that this is based on the percentage of parentView. Value range: 0–1

◆ setDefaultStreamRecvMode:video:()

- (void) setDefaultStreamRecvMode: (BOOL)  autoRecvAudio
video: (BOOL)  autoRecvVideo 

Set subscription mode (which must be set before room entry for it to take effect)

You can switch between the "automatic subscription" and "manual subscription" modes through this API:

  • Automatic subscription: this is the default mode, where the user will immediately receive the audio/video streams in the room after room entry, so that the audio will be automatically played back, and the video will be automatically decoded (you still need to bind the rendering control through the startRemoteView API).
  • Manual subscription: after room entry, the user needs to manually call the {@startRemoteView} API to start subscribing to and decoding the video stream and call the {@muteRemoteAudio} (false) API to start playing back the audio stream. In most scenarios, users will subscribe to the audio/video streams of all anchors in the room after room entry. Therefore, TRTC adopts the automatic subscription mode by default in order to achieve the best "instant streaming experience". In your application scenario, if there are many audio/video streams being published at the same time in each room, and each user only wants to subscribe to 1–2 streams of them, we recommend you use the "manual subscription" mode to reduce the traffic costs.
    Parameters
    autoRecvAudioYES: automatic subscription to audio; NO: manual subscription to audio by calling muteRemoteAudio(false). Default value: YES
    autoRecvVideoYES: automatic subscription to video; NO: manual subscription to video by calling startRemoteView. Default value: YES
    Attention
  1. The configuration takes effect only if this API is called before room entry (enterRoom).
  2. In the automatic subscription mode, if the user does not call {@startRemoteView} to subscribe to the video stream after room entry, the SDK will automatically stop subscribing to the video stream in order to reduce the traffic consumption.

◆ setEyeScaleLevel:()

- (void) setEyeScaleLevel: (float)  eyeScaleLevel

Set the strength of eye enlarging filter

Deprecated:
This API is not recommended after v6.9. Please use getBeautyManager instead.

◆ setFaceScaleLevel:()

- (void) setFaceScaleLevel: (float)  faceScaleLevel

Set the strength of face slimming filter

Deprecated:
This API is not recommended after v6.9. Please use getBeautyManager instead.

◆ setFaceShortLevel:()

- (void) setFaceShortLevel: (float)  faceShortlevel

Set the strength of face shortening filter

Deprecated:
This API is not recommended after v6.9. Please use getBeautyManager instead.

◆ setFaceVLevel:()

- (void) setFaceVLevel: (float)  faceVLevel

Set the strength of chin slimming filter

Deprecated:
This API is not recommended after v6.9. Please use getBeautyManager instead.

◆ setFilter:()

- (void) setFilter: (TXImage *)  image

Set color filter

Deprecated:
This API is not recommended after v7.2. Please use getBeautyManager instead.

◆ setFilterConcentration:()

- (void) setFilterConcentration: (float)  concentration

Set the strength of color filter

Deprecated:
This API is not recommended after v7.2. Please use getBeautyManager instead.

◆ setFocusPosition:()

- (void) setFocusPosition: (CGPoint)  touchPoint

Set the focal position of camera

Deprecated:
This API is not recommended after v8.0. Please use the setCameraFocusPosition API in TXDeviceManager instead.

◆ setGreenScreenFile:()

- (void) setGreenScreenFile: (NSURL *)  file

Set green screen video

Deprecated:
This API is not recommended after v7.2. Please use getBeautyManager instead.

◆ setGSensorMode:()

- (void) setGSensorMode: (TRTCGSensorMode mode

Set the adaptation mode of G-sensor

You can achieve the following user-friendly interactive experience through this API: When a phone or tablet is rotated upside down, as the capturing direction of the camera does not change, the video image viewed by other users in the room will become upside-down. In this case, you can call this API to let the SDK automatically adjust the rotation direction of the local video image and the image output by the encoder according to the direction of the device's gyroscope, so that remote viewers can see the image in the normal direction.

Parameters
modeG-sensor mode. For more information, please see TRTCGSensorMode. Default value: TRTCGSensorMode_UIAutoLayout

◆ setLocalProcessedAudioFrameDelegateFormat:()

- (int) setLocalProcessedAudioFrameDelegateFormat: (TRTCAudioFrameDelegateFormat *)  format

Set the callback format of preprocessed local audio frames

This API is used to set the AudioFrame format called back by onLocalProcessedAudioFrame:

  • sampleRate: sample rate. Valid values: 16000, 32000, 44100, 48000
  • channel: number of channels (if stereo is used, data is interwoven). Valid values: 1: mono channel; 2: dual channel
  • samplesPerCall: number of sample points, which defines the frame length of the callback data. The frame length must be an integer multiple of 10 ms.

If you want to calculate the callback frame length in milliseconds, the formula for converting the number of milliseconds into the number of sample points is as follows: number of sample points = number of milliseconds * sample rate / 1000 For example, if you want to call back the data of 20 ms frame length with 48000 sample rate, then the number of sample points should be entered as 960 = 20 * 48000 / 1000 Note that the frame length of the final callback is in bytes, and the calculation formula for converting the number of sample points into the number of bytes is as follows: number of bytes = number of sample points * number of channels * 2 (bit width) For example, if the parameters are 48000 sample rate, dual channel, 20 ms frame length, and 960 sample points, then the number of bytes is 3840 = 960 * 2 * 2

Parameters
formatAudio data callback format
Returns
0: success; values smaller than 0: error

◆ setLocalRenderParams:()

- (void) setLocalRenderParams: (TRTCRenderParams *)  params

Set the rendering parameters of local video image

The parameters that can be set include video image rotation angle, fill mode, and mirror mode.

Parameters
paramsVideo image rendering parameters. For more information, please see TRTCRenderParams.

◆ setLocalVideoProcessDelegete:pixelFormat:bufferType:()

- (int) setLocalVideoProcessDelegete: (id< TRTCVideoFrameDelegate >)  delegate
pixelFormat: (TRTCVideoPixelFormat pixelFormat
bufferType: (TRTCVideoBufferType bufferType 

Set video data callback for third-party beauty filters

After this callback is set, the SDK will call back the captured video frames through the delegate you set and use them for further processing by a third-party beauty filter component. Then, the SDK will encode and send the processed video frames.

Parameters
delegateCustom preprocessing callback. For more information, please see TRTCVideoFrameDelegate
pixelFormatSpecify the format of the pixel called back. Currently, only TRTCVideoPixelFormat_Texture_2D is supported
bufferTypeSpecify the format of the data called back. Currently, only TRTCVideoBufferType_Texture is supported
Returns
0: success; values smaller than 0: error

◆ setLocalVideoRenderDelegate:pixelFormat:bufferType:()

- (int) setLocalVideoRenderDelegate: (id< TRTCVideoRenderDelegate >)  delegate
pixelFormat: (TRTCVideoPixelFormat pixelFormat
bufferType: (TRTCVideoBufferType bufferType 

Set the callback of custom rendering for local video

After this callback is set, the SDK will skip its own rendering process and call back the captured data. Therefore, you need to complete image rendering on your own.

  • pixelFormat specifies the format of the called back data, such as NV12, I420, and 32BGRA.
  • bufferType specifies the buffer type. PixelBuffer has the highest efficiency, while NSData makes the SDK perform a memory conversion internally, which will result in extra performance loss.

For more information, please see Custom Capturing and Rendering.

Parameters
delegateCallback for custom rendering
pixelFormatSpecify the format of the pixel called back
bufferTypePixelBuffer: this can be directly converted to UIImage by using imageWithCVImageBuffer; NSData: this is memory-mapped video data.
Returns
0: success; values smaller than 0: error

◆ setLocalViewFillMode:()

- (void) setLocalViewFillMode: (TRTCVideoFillMode mode

Set the rendering mode of local image

Deprecated:
This API is not recommended after v8.0. Please use setLocalRenderParams instead.

◆ setLocalViewMirror:() [1/2]

- (void) setLocalViewMirror: (BOOL)  mirror

◆ setLocalViewMirror:() [2/2]

- (void) setLocalViewMirror: (TRTCLocalVideoMirrorType mirror

Set the mirror mode of local camera's preview image

Deprecated:
This API is not recommended after v8.0. Please use setLocalRenderParams instead.

◆ setLocalViewRotation:()

- (void) setLocalViewRotation: (TRTCVideoRotation rotation

Set the clockwise rotation angle of local image

Deprecated:
This API is not recommended after v8.0. Please use setLocalRenderParams instead.

◆ setLogCompressEnabled:()

+ (void) setLogCompressEnabled: (BOOL)  enabled

Enable/Disable local log compression

If compression is enabled, the log size will significantly reduce, 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 can be read directly in Notepad, but will take up more storage capacity.

Parameters
enabledSpecify whether to enable it, which is enabled by default

◆ setLogDelegate:()

+ (void) setLogDelegate: (id< TRTCLogDelegate >)  logDelegate

Set log callback

◆ setLogDirPath:()

+ (void) setLogDirPath: (NSString *)  path

Set local log storage path

You can use this API to change the default storage path of the SDK's local logs, which is as follows:

  • Windows: C:/Users/[username]/AppData/Roaming/liteav/log, i.e., under appdata%/liteav/log.
  • iOS or macOS: under sandbox Documents/log.
  • Android: under /app directory/files/log/liteav/.
    Attention
    Please be sure to call this API before all other APIs and make sure that the directory you specify exists and your application has read/write permissions of the directory.
    Parameters
    pathLog storage path

◆ setLogLevel:()

+ (void) setLogLevel: (TRTCLogLevel level

Set log output level

Parameters
levelFor more information, please see TRTCLogLevel. Default value: TRTCLogLevelNone

◆ setMicVolumeOnMixing:()

- (void) setMicVolumeOnMixing: (NSInteger)  volume

Set mic volume

Deprecated:
This API is not recommended after v6.9. Please use setAudioCaptureVolume instead.

◆ setMixedPlayAudioFrameDelegateFormat:()

- (int) setMixedPlayAudioFrameDelegateFormat: (TRTCAudioFrameDelegateFormat *)  format

Set the callback format of audio frames to be played back by system

This API is used to set the AudioFrame format called back by onMixedPlayAudioFrame:

  • sampleRate: sample rate. Valid values: 16000, 32000, 44100, 48000
  • channel: number of channels (if stereo is used, data is interwoven). Valid values: 1: mono channel; 2: dual channel
  • samplesPerCall: number of sample points, which defines the frame length of the callback data. The frame length must be an integer multiple of 10 ms.

If you want to calculate the callback frame length in milliseconds, the formula for converting the number of milliseconds into the number of sample points is as follows: number of sample points = number of milliseconds * sample rate / 1000 For example, if you want to call back the data of 20 ms frame length with 48000 sample rate, then the number of sample points should be entered as 960 = 20 * 48000 / 1000 Note that the frame length of the final callback is in bytes, and the calculation formula for converting the number of sample points into the number of bytes is as follows: number of bytes = number of sample points * number of channels * 2 (bit width) For example, if the parameters are 48000 sample rate, dual channel, 20 ms frame length, and 960 sample points, then the number of bytes is 3840 = 960 * 2 * 2

Parameters
formatAudio data callback format
Returns
0: success; values smaller than 0: error

◆ setMixExternalAudioVolume:playoutVolume:()

- (void) setMixExternalAudioVolume: (NSInteger)  publishVolume
playoutVolume: (NSInteger)  playoutVolume 

Set the publish volume and playback volume of mixed custom audio track

Parameters
publishVolumeset the publish volume,from 0 to 100, -1 means no change
playoutVolumeset the play volume,from 0 to 100, -1 means no change

◆ setMixTranscodingConfig:()

- (void) setMixTranscodingConfig: (TRTCTranscodingConfig *)  config

Set the layout and transcoding parameters of On-Cloud MixTranscoding

In a live room, there may be multiple anchors publishing their audio/video streams at the same time, but for audience on CSS CDN, they only need to watch one video stream in HTTP-FLV or HLS format. When you call this API, the SDK will send a command to the TRTC mixtranscoding server to combine multiple audio/video streams in the room into one stream. You can use the TRTCTranscodingConfig parameter to set the layout of each channel of image. You can also set the encoding parameters of the mixed audio/video streams. For more information, please see On-Cloud MixTranscoding.

    **Image 1** => decoding ====> \
                                   \
    **Image 2** => decoding => image mixing => encoding => **mixed image**
                                   //
    **Image 3** => decoding ====> //
    **Audio 1** => decoding ====> \
                                   \
    **Audio 2** => decoding => audio mixing => encoding => **mixed audio**
                                   //
    **Audio 3** => decoding ====> //
Parameters
configIf config is not empty, On-Cloud MixTranscoding will be started; otherwise, it will be stopped. For more information, please see TRTCTranscodingConfig.
Attention
Notes on On-Cloud MixTranscoding:
  • If the user calling this API does not set streamId in the config parameter, TRTC will mix the multiple channels of images in the room into the audio/video streams corresponding to the current user, i.e., A + B => A.
  • If the user calling this API sets streamId in the config parameter, TRTC will mix the multiple channels of images in the room into the specified streamId, i.e., A + B => streamId.
  • Please note that if you are still in the room but do not need mixtranscoding anymore, be sure to call this API again and leave config empty to cancel it; otherwise, additional fees may be incurred.
  • Please rest assured that TRTC will automatically cancel the mixtranscoding status upon room exit.

◆ setMotionMute:()

- (void) setMotionMute: (BOOL)  motionMute

Mute animated sticker

Deprecated:
This API is not recommended after v6.9. Please use getBeautyManager instead.

◆ setNetworkQosParam:()

- (void) setNetworkQosParam: (TRTCNetworkQosParam *)  param

Set network quality control parameters

This setting determines the quality control policy in a poor network environment, such as "image quality preferred" or "smoothness preferred".

Parameters
paramIt is used to set relevant parameters for network quality control. For details, please refer to TRTCNetworkQosParam.

◆ setNoseSlimLevel:()

- (void) setNoseSlimLevel: (float)  noseSlimLevel

Set the strength of nose slimming filter

Deprecated:
This API is not recommended after v6.9. Please use getBeautyManager instead.

◆ setPriorRemoteVideoStreamType:()

- (void) setPriorRemoteVideoStreamType: (TRTCVideoStreamType streamType

Specify whether to view the big or small image

Deprecated:
This API is not recommended after v8.0. Please use startRemoteView:streamType:view: instead.

◆ setRemoteAudioVolume:volume:()

- (void) setRemoteAudioVolume: (NSString *)  userId
volume: (int)  volume 

Set the audio playback volume of remote user

You can mute the audio of a remote user through setRemoteAudioVolume(userId, 0).

Parameters
userIdID of the specified remote user
volumeVolume. 100 is the original volume. Value range: [0,150]. Default value: 100
Attention
If 100 is still not loud enough for you, you can set the volume to up to 150, but there may be side effects.

◆ setRemoteRenderParams:streamType:params:()

- (void) setRemoteRenderParams: (NSString *)  userId
streamType: (TRTCVideoStreamType streamType
params: (TRTCRenderParams *)  params 

Set the rendering mode of remote video image

The parameters that can be set include video image rotation angle, fill mode, and mirror mode.

Parameters
userIdID of the specified remote user
streamTypeIt can be set to the primary stream image (TRTCVideoStreamTypeBig) or substream image (TRTCVideoStreamTypeSub).
paramsVideo image rendering parameters. For more information, please see TRTCRenderParams.

◆ setRemoteSubStreamViewFillMode:mode:()

- (void) setRemoteSubStreamViewFillMode: (NSString *)  userId
mode: (TRTCVideoFillMode mode 

Set the fill mode of substream image

Deprecated:
This API is not recommended after v8.0. Please use setRemoteRenderParams:streamType:params: instead.

◆ setRemoteSubStreamViewRotation:rotation:()

- (void) setRemoteSubStreamViewRotation: (NSString *)  userId
rotation: (TRTCVideoRotation rotation 

Set the clockwise rotation angle of substream image

Deprecated:
This API is not recommended after v8.0. Please use setRemoteRenderParams:streamType:params: instead.

◆ setRemoteVideoRenderDelegate:delegate:pixelFormat:bufferType:()

- (int) setRemoteVideoRenderDelegate: (NSString *)  userId
delegate: (id< TRTCVideoRenderDelegate >)  delegate
pixelFormat: (TRTCVideoPixelFormat pixelFormat
bufferType: (TRTCVideoBufferType bufferType 

Set the callback of custom rendering for remote video

After this callback is set, the SDK will skip its own rendering process and call back the captured data. Therefore, you need to complete image rendering on your own.

  • pixelFormat specifies the format of the called back data, such as NV12, I420, and 32BGRA.
  • bufferType specifies the buffer type. PixelBuffer has the highest efficiency, while NSData makes the SDK perform a memory conversion internally, which will result in extra performance loss.

For more information, please see Custom Capturing and Rendering.

Attention
Before this API is called, startRemoteView(nil) needs to be called to get the video stream of the remote user (view can be set to nil for this end); otherwise, there will be no data called back.
Parameters
userIdID of the specified remote user
delegateCallback for custom rendering
pixelFormatSpecify the format of the pixel called back
bufferTypePixelBuffer: this can be directly converted to UIImage by using imageWithCVImageBuffer; NSData: this is memory-mapped video data.
Returns
0: success; values smaller than 0: error

◆ setRemoteVideoStreamType:type:()

- (void) setRemoteVideoStreamType: (NSString *)  userId
type: (TRTCVideoStreamType streamType 

Switch the big/small image of specified remote user

After an anchor in a room enables dual-channel encoding, the video image that other users in the room subscribe to through startRemoteView will be HD big image by default. You can use this API to select whether the image subscribed to is the big image or small image. The API can take effect before or after startRemoteView is called.

Attention
To implement this feature, the target user must have enabled the dual-channel encoding mode through enableEncSmallVideoStream; otherwise, this API will not work.
Parameters
userIdID of the specified remote user
streamTypeVideo stream type, i.e., big image or small image. Default value: big image

◆ setRemoteViewFillMode:mode:()

- (void) setRemoteViewFillMode: (NSString *)  userId
mode: (TRTCVideoFillMode mode 

Set the rendering mode of remote image

Deprecated:
This API is not recommended after v8.0. Please use setRemoteRenderParams:streamType:params: instead.

◆ setRemoteViewRotation:rotation:()

- (void) setRemoteViewRotation: (NSString *)  userId
rotation: (TRTCVideoRotation rotation 

Set the clockwise rotation angle of remote image

Deprecated:
This API is not recommended after v8.0. Please use setRemoteRenderParams:streamType:params: instead.

◆ setReverbType:()

- (void) setReverbType: (TRTCReverbType reverbType

Set reverb effect

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#setVoiceReverbType instead.

◆ setSubStreamEncoderParam:()

- (void) setSubStreamEncoderParam: (TRTCVideoEncParam *)  param

Set the video encoding parameters of screen sharing (i.e., substream) (for desktop systems only)

This API can set the image quality of screen sharing (i.e., the substream) viewed by remote users, which is also the image quality of screen sharing in on-cloud recording files. Please note the differences between the following two APIs:

Parameters
paramSubstream encoding parameters. For more information, please see TRTCVideoEncParam.
Attention
Even if you use the primary stream to transfer screen sharing data (set type=TRTCVideoStreamTypeBig when calling startScreenCapture), you still need to call the setSubStreamEncoderParam API instead of the {} API to set the screen sharing encoding parameters.

◆ setSubStreamMixVolume:()

- (void) setSubStreamMixVolume: (NSInteger)  volume

Set the audio mixing volume of screen sharing (for desktop systems only)

The greater the value, the larger the ratio of the screen sharing volume to the mic volume. We recommend you not set a high value for this parameter as a high volume will cover the mic sound.

Parameters
volumeSet audio mixing volume. Value range: 0–100

◆ setSystemAudioLoopbackVolume:()

- (void) setSystemAudioLoopbackVolume: (uint32_t)  volume

Set the volume of system audio capturing

Parameters
volumeSet volume. Value range: [0, 150]. Default value: 100

◆ setSystemVolumeType:()

- (void) setSystemVolumeType: (TRTCSystemVolumeType type

Setting the system volume type (for mobile OS)

Deprecated:
This API is not recommended after v8.0. Please use the setSystemVolumeType API in TXDeviceManager instead.

◆ setVideoEncoderMirror:()

- (void) setVideoEncoderMirror: (BOOL)  mirror

Set the mirror mode of image output by encoder

This setting does not affect the mirror mode of the local video image, but affects the mirror mode of the image viewed by other users in the room (and on-cloud recording files).

Parameters
mirrorWhether to enable remote mirror mode. true: yes; false: no. Default value: false

◆ setVideoEncoderParam:()

- (void) setVideoEncoderParam: (TRTCVideoEncParam *)  param

Set the encoding parameters of video encoder

This setting can determine the quality of image viewed by remote users, which is also the image quality of on-cloud recording files.

Parameters
paramIt is used to set relevant parameters for the video encoder. For more information, please see TRTCVideoEncParam.

◆ setVideoEncoderRotation:()

- (void) setVideoEncoderRotation: (TRTCVideoRotation rotation

Set the direction of image output by video encoder

This setting does not affect the preview direction of the local video image, but affects the direction of the image viewed by other users in the room (and on-cloud recording files). When a phone or tablet is rotated upside down, as the capturing direction of the camera does not change, the video image viewed by other users in the room will become upside-down. In this case, you can call this API to rotate the image encoded by the SDK 180 degrees, so that other users in the room can view the image in the normal direction. If you want to achieve the aforementioned user-friendly interactive experience, we recommend you directly call setGSensorMode to implement smarter direction adaptation, with no need to call this API manually.

Parameters
rotationCurrently, rotation angles of 0 and 180 degrees are supported. Default value: TRTCVideoRotation_0 (no rotation)

◆ setVideoMuteImage:fps:()

- (void) setVideoMuteImage: (TXImage *)  image
fps: (NSInteger)  fps 

Set placeholder image during local video pause

When you call muteLocalVideo(true) to pause the local video image, you can set a placeholder image by calling this API. Then, other users in the room will see this image instead of a black screen.

Parameters
imagePlaceholder image. A null value means that no more video stream data will be sent after muteLocalVideo. The default value is null.
fpsFrame rate of the placeholder image. Minimum value: 5. Maximum value: 10. Default value: 5

◆ setVoiceChangerType:()

- (void) setVoiceChangerType: (TRTCVoiceChangerType voiceChangerType

Set voice changing type

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#setVoiceChangerType instead.

◆ setWatermark:streamType:rect:()

- (void) setWatermark: (TXImage *)  image
streamType: (TRTCVideoStreamType streamType
rect: (CGRect)  rect 

Add watermark

The watermark position is determined by the rect parameter, which is a quadruple in the format of (x, y, width, height).

  • x: X coordinate of watermark, which is a floating-point number between 0 and 1.
  • y: Y coordinate of watermark, which is a floating-point number between 0 and 1.
  • width: width of watermark, which is a floating-point number between 0 and 1.
  • height: it does not need to be set. The SDK will automatically calculate it according to the watermark image's aspect ratio.

Sample parameter: If the encoding resolution of the current video is 540x960, and the rect parameter is set to (0.1, 0.1, 0.2, 0.0), then the coordinates of the top-left point of the watermark will be (540 *, 960 * 0.1), i.e., (54, 96), the watermark width will be 540 * 0.2 = 108 px, and the watermark height will be calculated automatically by the SDK based on the watermark image's aspect ratio.

Parameters
imageWatermark image, which must be a PNG image with transparent background
streamTypeSpecify for which image to set the watermark. For more information, please see TRTCVideoStreamType.
rectUnified coordinates of the watermark relative to the encoded resolution. Value range of x, y, width, and height: 0–1.
Attention
If you want to set watermarks for both the primary image (generally for the camera) and the substream image (generally for screen sharing), you need to call this API twice with streamType set to different values.

◆ setZoom:()

- (void) setZoom: (CGFloat)  distance

Set camera zoom ratio (focal length)

Deprecated:
This API is not recommended after v8.0. Please use the setCameraZoomRatio API in TXDeviceManager instead.

◆ sharedInstance()

+ (instancetype) sharedInstance

Create TRTCCloud instance (singleton mode)

◆ showDebugView:()

- (void) showDebugView: (NSInteger)  showType

Display dashboard

"Dashboard" is a semi-transparent floating layer for debugging information on top of the video rendering control. It is used to display audio/video information and event information to facilitate integration and debugging.

Parameters
showType0: does not display; 1: displays lite edition (only with audio/video information); 2: displays full edition (with audio/video information and event information).

◆ snapshotVideo:type:completionBlock:()

- (void) snapshotVideo: (NSString *)  userId
type: (TRTCVideoStreamType streamType
completionBlock: (void(^)(TXImage *image))  completionBlock 

Screencapture video

Deprecated:
This API is not recommended after v8.2. Please use snapshotVideo:type:sourceType:completionBlock instead.

◆ snapshotVideo:type:sourceType:completionBlock:()

- (void) snapshotVideo: (NSString *)  userId
type: (TRTCVideoStreamType streamType
sourceType: (TRTCSnapshotSourceType sourceType
completionBlock: (void(^)(TXImage *image))  completionBlock 

Screencapture video

You can use this API to screencapture the local video image or the primary stream image and substream (screen sharing) image of a remote user.

Parameters
userIdUser ID. A null value indicates to screencapture the local video.
streamTypeVideo stream type, which can be the primary stream image (TRTCVideoStreamTypeBig, generally for camera) or substream image (TRTCVideoStreamTypeSub, generally for screen sharing)
sourceTypeVideo image source, which can be the video stream image (TRTCSnapshotSourceTypeStream, generally in higher definition) or the video rendering image (TRTCSnapshotSourceTypeView)
Attention
On Windows, only video image from the TRTCSnapshotSourceTypeStream source can be screencaptured currently.

◆ startAudioRecording:()

- (int) startAudioRecording: (TRTCAudioRecordingParams *)  param

Start audio recording

After you call this API, the SDK will selectively record local and remote audio streams (such as local audio, remote audio, background music, and sound effects) into a local file. This API works when called either before or after room entry. If a recording task has not been stopped through stopAudioRecording before room exit, it will be automatically stopped after room exit.

Parameters
paramRecording parameter. For more information, please see TRTCAudioRecordingParams
Returns
0: success; -1: audio recording has been started; -2: failed to create file or directory; -3: the audio format of the specified file extension is not supported

◆ startCameraDeviceTestInView:()

- (void) startCameraDeviceTestInView: (NSView *)  view

Start camera test

Deprecated:
This API is not recommended after v8.0. Please use the startCameraDeviceTest API in TXDeviceManager instead.

◆ startLocalAudio()

- (void) startLocalAudio

Set sound quality

Deprecated:
This API is not recommended after v8.0. Please use startLocalAudio:(quality) instead.

◆ startLocalAudio:()

- (void) startLocalAudio: (TRTCAudioQuality quality

Enable local audio capturing and publishing

The SDK does not enable the mic by default. When a user wants to publish the local audio, the user needs to call this API to enable mic capturing and encode and publish the audio to the current room. After local audio capturing and publishing is enabled, other users in the room will receive the onUserAudioAvailable(userId, true) notification.

Parameters
qualitySound quality
  • TRTCAudioQualitySpeech - Smooth: sample rate: 16 kHz; mono channel; audio bitrate: 16 Kbps. This is suitable for audio call scenarios, such as online meeting and audio call.
  • TRTCAudioQualityDefault - Default: sample rate: 48 kHz; mono channel; audio bitrate: 50 Kbps. This is the default sound quality of the SDK and recommended if there are no special requirements.
  • TRTCAudioQualityMusic - HD: sample rate: 48 kHz; dual channel + full band; audio bitrate: 128 Kbps. This is suitable for scenarios where Hi-Fi music transfer is required, such as online karaoke and music live streaming.
Attention
This API will check the mic permission. If the current application does not have permission to use the mic, the SDK will automatically ask the user to grant the mic permission.

◆ startLocalPreview:()

- (void) startLocalPreview: (TXView *)  view

Enable the preview image of local camera (desktop)

Before this API is called, setCurrentCameraDevice can be called first to select whether to use the macOS device's built-in camera or an external camera. If this API is called before enterRoom, the SDK will only enable the camera and wait until enterRoom is called before starting push. If it is called after enterRoom, the SDK will enable the camera and automatically start pushing the video stream. When the first camera video frame starts to be rendered, you will receive the onCameraDidReady callback in TRTCCloudDelegate.

Parameters
viewControl that carries the video image
Attention
If you want to preview the camera image and adjust the beauty filter parameters through BeautyManager before going live, you can:
  • Scheme 1. Call startLocalPreview before calling enterRoom
  • Scheme 2. Call startLocalPreview and muteLocalVideo(true) after calling enterRoom

◆ startLocalPreview:view:()

- (void) startLocalPreview: (BOOL)  frontCamera
view: (TXView *)  view 

Enable the preview image of local camera (mobile)

If this API is called before enterRoom, the SDK will only enable the camera and wait until enterRoom is called before starting push. If it is called after enterRoom, the SDK will enable the camera and automatically start pushing the video stream. When the first camera video frame starts to be rendered, you will receive the onCameraDidReady callback in TRTCCloudDelegate.

Parameters
frontCameraYES: front camera; NO: rear camera
viewControl that carries the video image
Attention
If you want to preview the camera image and adjust the beauty filter parameters through BeautyManager before going live, you can:
  • Scheme 1. Call startLocalPreview before calling enterRoom
  • Scheme 2. Call startLocalPreview and muteLocalVideo(true) after calling enterRoom

◆ startLocalRecording:()

- (void) startLocalRecording: (TRTCLocalRecordingParams *)  params

Start local media recording

This API records the audio/video content during live streaming into a local file.

Parameters
paramsRecording parameter. For more information, please see TRTCLocalRecordingParams

◆ startMicDeviceTest:testEcho:()

- (void) startMicDeviceTest: (NSInteger)  interval
testEcho: (void(^)(NSInteger volume))  testEcho 

Start mic test

Deprecated:
This API is not recommended after v8.0. Please use the startMicDeviceTest API in TXDeviceManager instead.

◆ startPublishCDNStream:()

- (void) startPublishCDNStream: (TRTCPublishCDNParam *)  param

Start publishing audio/video streams to non-Tencent Cloud CDN

This API is similar to the startPublishing API. The difference is that startPublishing can only publish audio/video streams to Tencent Cloud CDN, while this API can relay streams to live streaming CDN services of other cloud providers.

Parameters
paramCDN relaying parameter. For more information, please see TRTCPublishCDNParam
Attention
  • Using the startPublishing API to publish audio/video streams to Tencent Cloud CSS CDN does not incur additional fees.
  • Using the startPublishCDNStream API to publish audio/video streams to non-Tencent Cloud CDN incurs additional relaying bandwidth fees.

◆ startPublishing:type:()

- (void) startPublishing: (NSString *)  streamId
type: (TRTCVideoStreamType streamType 

Start publishing audio/video streams to Tencent Cloud CSS CDN

This API sends a command to the TRTC server, requesting it to relay the current user's audio/video streams to CSS CDN. You can set the StreamId of the live stream through the streamId parameter, so as to specify the playback address of the user's audio/video streams on CSS CDN. For example, if you specify the current user's live stream ID as user_stream_001 through this API, then the corresponding CDN playback address is: "http://yourdomain/live/user_stream_001.flv", where yourdomain is your playback domain name with an ICP filing. You can configure your playback domain name in the CSS console. Tencent Cloud does not provide a default playback domain name.

TRTCCloud *trtcCloud = [TRTCCloud sharedInstance];
[trtcCloud enterRoom:params appScene:TRTCAppSceneLIVE];
[trtcCloud startLocalPreview:frontCamera view:localView];
[trtcCloud startLocalAudio];
[trtcCloud startPublishing: "user_stream_001" type:TRTCVideoStreamTypeBig];

You can also specify the streamId when setting the TRTCParams parameter of enterRoom, which is the recommended approach.

Parameters
streamIdCustom stream ID.
streamTypeOnly TRTCVideoStreamTypeBig and TRTCVideoStreamTypeSub are supported.
Attention
You need to enable the "Enable Relayed Push" option on the "Function Configuration" page in the TRTC console in advance.
  • If you select "Specified stream for relayed push", you can use this API to push the corresponding audio/video stream to Tencent Cloud CDN and specify the entered stream ID.
  • If you select "Global auto-relayed push", you can use this API to adjust the default stream ID.

◆ startRemoteSubStreamView:view:()

- (void) startRemoteSubStreamView: (NSString *)  userId
view: (TXView *)  view 

Start displaying the substream image of remote user

Deprecated:
This API is not recommended after v8.0. Please use startRemoteView:streamType:view instead.

◆ startRemoteView:streamType:view:()

- (void) startRemoteView: (NSString *)  userId
streamType: (TRTCVideoStreamType streamType
view: (TXView *)  view 

Subscribe to remote user's video stream and bind video rendering control

Calling this API allows the SDK to pull the video stream of the specified userId and render it to the rendering control specified by the view parameter. You can set the display mode of the video image through setRemoteRenderParams.

  • If you already know the userId of a user who has a video stream in the room, you can directly call startRemoteView to subscribe to the user's video image.
  • If you don't know which users in the room are publishing video streams, you can wait for the notification from onUserVideoAvailable after enterRoom.

Calling this API only starts pulling the video stream, and the image needs to be loaded and buffered at this time. After the buffering is completed, you will receive a notification from onFirstVideoFrame.

Parameters
userIdID of the specified remote user
streamTypeVideo stream type of the userId specified for watching:
viewRendering control that carries the video image
Attention
The following requires your attention:
  1. The SDK supports watching the big image and substream image or small image and substream image of a userId at the same time, but does not support watching the big image and small image at the same time.
  2. Only when the specified userId enables dual-channel encoding through enableEncSmallVideoStream can the user's small image be viewed.
  3. If the small image of the specified userId does not exist, the SDK will switch to the big image of the user by default.

◆ startRemoteView:view:()

- (void) startRemoteView: (NSString *)  userId
view: (TXView *)  view 

Start displaying remote video image

Deprecated:
This API is not recommended after v8.0. Please use startRemoteView:streamType:view instead.

◆ startScreenCapture:()

- (void) startScreenCapture: (NSView *)  view

Start screen sharing

Deprecated:
This API is not recommended after v7.2. Please use startScreenCapture:streamType:encParam: instead.

◆ startScreenCapture:streamType:encParam:()

- (void) startScreenCapture: (NSView *)  view
streamType: (TRTCVideoStreamType streamType
encParam: (TRTCVideoEncParam *)  encParam 

Start desktop screen sharing (for desktop systems only)

This API can capture the screen content of the entire macOS system or a specified application and share it with other users in the same room.

Parameters
viewParent control of the rendering control, which can be set to a null value, indicating not to display the preview of the shared screen.
streamTypeChannel used for screen sharing, which can be the primary stream (TRTCVideoStreamTypeBig) or substream (TRTCVideoStreamTypeSub).
encParamImage encoding parameters used for screen sharing, which can be set to nil, indicating to let the SDK choose the optimal encoding parameters (such as resolution and bitrate).
Attention
  1. A user can publish at most one primary stream (TRTCVideoStreamTypeBig) and one substream (TRTCVideoStreamTypeSub) at the same time.
  2. By default, screen sharing uses the substream image. If you want to use the primary stream for screen sharing, you need to stop camera capturing (through stopLocalPreview) in advance to avoid conflicts.
  3. Only one user can use the substream for screen sharing in the same room at any time; that is, only one user is allowed to enable the substream in the same room at any time.
  4. When there is already a user in the room using the substream for screen sharing, calling this API will return the onError(ERR_SERVER_CENTER_ANOTHER_USER_PUSH_SUB_VIDEO) callback from TRTCCloudDelegate.

◆ startScreenCaptureByReplaykit:appGroup:()

- (void) startScreenCaptureByReplaykit: (TRTCVideoEncParam *)  encParams
appGroup: (NSString *)  appGroup 

Start system-level screen sharing (for iOS 11.0 and above only)

Deprecated:
This API is not recommended after v8.6. Please use startScreenCaptureByReplaykit:encParam:appGroup: instead.

◆ startScreenCaptureByReplaykit:encParam:appGroup:()

- (void) startScreenCaptureByReplaykit: (TRTCVideoStreamType streamType
encParam: (TRTCVideoEncParam *)  encParams
appGroup: (NSString *)  appGroup 

Start system-level screen sharing (for iOS 11.0 and above only)

This API supports capturing the screen of the entire iOS system, which can implement system-wide screen sharing similar to VooV Meeting. However, the integration steps are slightly more complicated than those of startScreenCaptureInApp. You need to implement a ReplayKit extension module for your application. For more information, please see iOS Video encoding parameters recommended for screen sharing on iPhone (TRTCVideoEncParam):

  • Resolution (videoResolution): 1280x720
  • Frame rate (videoFps): 10 fps
  • Bitrate (videoBitrate): 1600 Kbps
  • Resolution adaption (enableAdjustRes): NO
Parameters
streamTypeChannel used for screen sharing, which can be the primary stream (TRTCVideoStreamTypeBig) or substream (TRTCVideoStreamTypeSub).
encParamsVideo encoding parameters for screen sharing. We recommend you use the above configuration. If you set encParams to nil, the SDK will use the video encoding parameters you set before calling the startScreenCapture API.
appGroupSpecify the Application Group Identifier shared by your application and the screen sharing process. You can specify this parameter as nil, but we recommend you set it as instructed in the documentation for higher reliability.

◆ startScreenCaptureInApp:()

- (void) startScreenCaptureInApp: (TRTCVideoEncParam *)  encParams

tart in-app screen sharing (for iOS 13.0 and above only)

Deprecated:
This API is not recommended after v8.6. Please use startScreenCaptureInApp:encParam: instead.

◆ startScreenCaptureInApp:encParam:()

- (void) startScreenCaptureInApp: (TRTCVideoStreamType streamType
encParam: (TRTCVideoEncParam *)  encParams 

Start in-app screen sharing (for iOS 13.0 and above only)

This API captures the real-time screen content of the current application and shares it with other users in the same room. It is applicable to iOS 13.0 and above. If you want to capture the screen content of the entire iOS system (instead of the current application), we recommend you use startScreenCaptureByReplaykit. Video encoding parameters recommended for screen sharing on iPhone (TRTCVideoEncParam):

  • Resolution (videoResolution): 1280x720
  • Frame rate (videoFps): 10 fps
  • Bitrate (videoBitrate): 1600 Kbps
  • Resolution adaption (enableAdjustRes): NO
Parameters
streamTypeChannel used for screen sharing, which can be the primary stream (TRTCVideoStreamTypeBig) or substream (TRTCVideoStreamTypeSub).
encParamsVideo encoding parameters for screen sharing. We recommend you use the above configuration. If you set encParams to nil, the SDK will use the video encoding parameters you set before calling the startScreenCapture API.

◆ startSpeakerDeviceTest:onVolumeChanged:()

- (void) startSpeakerDeviceTest: (NSString *)  audioFilePath
onVolumeChanged: (void(^)(NSInteger volume, BOOL isLastFrame))  volumeBlock 

Start speaker test

Deprecated:
This API is not recommended after v8.0. Please use the startSpeakerDeviceTest API in TXDeviceManager instead.

◆ startSpeedTest:userId:userSig:completion:()

- (void) startSpeedTest: (uint32_t)  sdkAppId
userId: (NSString *)  userId
userSig: (NSString *)  userSig
completion: (void(^)(TRTCSpeedTestResult *result, NSInteger completedCount, NSInteger totalCount))  completion 

Start network speed test (used before room entry)

As TRTC involves real-time audio/video transfer services very sensitive to the transfer latency, it has high requirements for network stability. For most users, if their network environments are below TRTC's minimum requirements, direct room entry will cause a very poor user experience. The recommended approach is to perform the network speed test before the user enters the room, so that a reminder can be displayed on the UI to prompt the user to switch to a better network (such as from Wi-Fi to 4G) first before room entry if the user's network is poor.

Attention
  1. The speed test will consume a certain amount of traffic and generate a small amount of extra traffic fees as a result.
  2. Please perform the speed test before room entry, because if performed after room entry, the test will affect the normal audio/video transfer, and its result will be inaccurate due to interference in the room.
Parameters
sdkAppIdApplication ID. For more information, please see TRTCParams.
userIdUser ID. For more information, please see TRTCParams.
userSigUser signature. For more information, please see TRTCParams.

◆ startSystemAudioLoopback()

- (void) startSystemAudioLoopback

Enable system audio capturing (for desktop systems only)

This API captures audio data from the sound card of a macOS computer and mixes it into the current audio data stream of the SDK, so that other users in the room can also hear the sound played back on the current macOS system. In use cases such as video teaching or music live streaming, the teacher can use this feature to let the SDK capture the sound in the video played back by the teacher, so that students in the same room can also hear the sound in the video.

Attention
  1. This feature needs to install a virtual audio device plugin on the user's macOS system. After the installation is completed, the SDK will capture sound from the installed virtual device.
  2. The SDK will automatically download the appropriate plugin from the internet for installation, but the download may be slow. If you want to speed up this process, you can package the virtual audio plugin file into the Resources directory of your app bundle.

◆ stopAllAudioEffects()

- (void) stopAllAudioEffects

Stop all sound effects

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#stopPlayMusic instead.

◆ stopAllRemoteView()

- (void) stopAllRemoteView

Stop subscribing to all remote users' video streams and release all rendering resources

Calling this API will cause the SDK to stop receiving all remote video streams and release all decoding and rendering resources.

Attention
If a substream image (screen sharing) is being displayed, it will also be stopped.

◆ stopAudioEffect:()

- (void) stopAudioEffect: (int)  effectId

Stop sound effect

Deprecated:
This API is not recommended after v7.3. Please use TXAudioEffectManager#stopPlayMusic instead.

◆ stopAudioRecording()

- (void) stopAudioRecording

Stop audio recording

If a recording task has not been stopped through this API before room exit, it will be automatically stopped after room exit.

◆ stopBGM()

- (void) stopBGM

Stop background music

Deprecated:
This API is not recommended after v7.3. Please use getAudioEffectManager instead.

◆ stopCameraDeviceTest()

- (void) stopCameraDeviceTest

Start camera test

Deprecated:
This API is not recommended after v8.0. Please use the stopCameraDeviceTest API in TXDeviceManager instead.

◆ stopLocalAudio()

- (void) stopLocalAudio

Stop local audio capturing and publishing

After local audio capturing and publishing is stopped, other users in the room will receive the onUserAudioAvailable(userId, false) notification.

◆ stopLocalPreview()

- (void) stopLocalPreview

Stop camera preview

◆ stopLocalRecording()

- (void) stopLocalRecording

Stop local media recording

If a recording task has not been stopped through this API before room exit, it will be automatically stopped after room exit.

◆ stopMicDeviceTest()

- (void) stopMicDeviceTest

Start mic test

Deprecated:
This API is not recommended after v8.0. Please use the stopMicDeviceTest API in TXDeviceManager instead.

◆ stopPublishCDNStream()

- (void) stopPublishCDNStream

Stop publishing audio/video streams to non-Tencent Cloud CDN

◆ stopPublishing()

- (void) stopPublishing

Stop publishing audio/video streams to Tencent Cloud CSS CDN

◆ stopRemoteSubStreamView:()

- (void) stopRemoteSubStreamView: (NSString *)  userId

Stop displaying the substream image of remote user

Deprecated:
This API is not recommended after v8.0. Please use stopRemoteView:streamType: instead.

◆ stopRemoteView:()

- (void) stopRemoteView: (NSString *)  userId

Stop displaying remote video image and pulling the video data stream of remote user

Deprecated:
This API is not recommended after v8.0. Please use stopRemoteView:streamType: instead.

◆ stopRemoteView:streamType:()

- (void) stopRemoteView: (NSString *)  userId
streamType: (TRTCVideoStreamType streamType 

Stop subscribing to remote user's video stream and release rendering control

Calling this API will cause the SDK to stop receiving the user's video stream and release the decoding and rendering resources for the stream.

Parameters
userIdID of the specified remote user
streamTypeVideo stream type of the userId specified for watching:

◆ stopScreenCapture()

- (int) stopScreenCapture

Stop screen sharing

◆ stopSpeakerDeviceTest()

- (void) stopSpeakerDeviceTest

Stop speaker test

Deprecated:
This API is not recommended after v8.0. Please use the stopSpeakerDeviceTest API in TXDeviceManager instead.

◆ stopSpeedTest()

- (void) stopSpeedTest

Stop network speed test

◆ stopSystemAudioLoopback()

- (void) stopSystemAudioLoopback

Stop system audio capturing (for desktop systems only)

◆ switchCamera()

- (void) switchCamera

Switch camera

Deprecated:
This API is not recommended after v8.0. Please use the switchCamera API in TXDeviceManager instead.

◆ switchRole:()

- (void) switchRole: (TRTCRoleType role

Switch role

This API is used to switch the user role between "anchor" and "audience". As video live rooms and audio chat rooms need to support an audience of up to 100,000 concurrent online users, the rule "only anchors can publish their audio/video streams" has been set. Therefore, when some users want to publish their streams (so that they can interact with anchors), they need to switch their role to "anchor" first. You can use the role field in TRTCParams during room entry to specify the user role in advance or use the switchRole API to switch roles after room entry.

Parameters
roleRole, which is "anchor" by default:

◆ switchRoom:()

- (void) switchRoom: (TRTCSwitchRoomConfig *)  config

Switch room

This API is used to quickly switch a user from one room to another.

  • If the user's role is "audience", calling this API is equivalent to exitRoom (current room) + enterRoom (new room).
  • If the user's role is "anchor", the API will retain the current audio/video publishing status while switching the room; therefore, during the room switch, camera preview and sound capturing will not be interrupted. This API is suitable for the online education scenario where the supervising teacher can perform fast room switch across multiple rooms. In this scenario, using switchRoom can get better smoothness and use less code than exitRoom + enterRoom. The API call result will be called back through onSwitchRoom(errCode, errMsg) in TRTCCloudDelegate.
    Parameters
    configRoom parameter. For more information, please see TRTCSwitchRoomConfig.
    Attention
    Due to the requirement for compatibility with legacy versions of the SDK, the config parameter contains both roomId and strRoomId parameters. You should pay special attention as detailed below when specifying these two parameters:
  1. If you decide to use strRoomId, then set roomId to 0. If both are specified, roomId will be used.
  2. All rooms need to use either strRoomId or roomId at the same time. They cannot be mixed; otherwise, there will be many unexpected bugs.

◆ updateLocalView:()

- (void) updateLocalView: (TXView *)  view

Update the preview image of local camera

◆ updateRemoteView:streamType:forUser:()

- (void) updateRemoteView: (TXView *)  view
streamType: (TRTCVideoStreamType streamType
forUser: (NSString *)  userId 

Update remote user's video rendering control

This API can be used to update the rendering control of the remote video image. It is often used in interactive scenarios where the display area needs to be switched.

Parameters
viewControl that carries the video image
streamTypeType of the stream for which to set the preview window (only TRTCVideoStreamTypeBig and TRTCVideoStreamTypeSub are supported)
userIdID of the specified remote user

Property Documentation

◆ delegate

- (id<TRTCCloudDelegate>) delegate
readwritenonatomicweak

Set TRTC event callback

You can use TRTCCloudDelegate to get various event notifications from the SDK, such as error codes, warning codes, and audio/video status parameters.

◆ delegateQueue

- (dispatch_queue_t) delegateQueue
readwritenonatomicstrong

Set the queue that drives the TRTCCloudDelegate event callback

If you do not specify a delegateQueue, the SDK will use MainQueue as the queue for driving TRTCCloudDelegate event callbacks by default. In other words, if you do not set the delegateQueue attribute, all callback functions in TRTCCloudDelegate will be driven by MainQueue.

Attention
If you specify a delegateQueue, please do not manipulate the UI in the TRTCCloudDelegate callback function; otherwise, thread safety issues will occur.