Blame view

HHVDoctorSDK/TXLiteAVSDK_TRTC.framework/Headers/TRTCCloud.h 111 KB
1
/**
liumingming authored
2
 * Module:   TRTCCloud @ TXLiteAVSDK
3
 * Function: 腾讯云 TRTC 主功能接口
wangguolei authored
4
 * Version: 9.4.10918
liumingming authored
5 6 7 8 9 10 11 12 13 14
 */
#import <Foundation/Foundation.h>
#import <VideoToolbox/VideoToolbox.h>
#import "TRTCCloudDelegate.h"
#import "TRTCCloudDef.h"
#import "TXBeautyManager.h"
#import "TXAudioEffectManager.h"
#import "TXDeviceManager.h"

/// @defgroup TRTCCloud_ios TRTCCloud
15
/// 腾讯云 TRTC 主功能接口
liumingming authored
16 17 18
/// @{
@interface TRTCCloud : NSObject
19
+ (instancetype)new __attribute__((unavailable("Use +sharedInstance instead")));
liumingming authored
20 21 22 23
- (instancetype)init __attribute__((unavailable("Use +sharedInstance instead")));

/////////////////////////////////////////////////////////////////////////////////
//
24
//                    创建实例和事件回调
liumingming authored
25 26
//
/////////////////////////////////////////////////////////////////////////////////
27
/// @name 创建实例和事件回调
liumingming authored
28 29 30
/// @{

/**
31 32
 * 1.1 创建 TRTCCloud 实例(单例模式)
 */
liumingming authored
33 34 35
+ (instancetype)sharedInstance;

/**
36 37
 * 1.2 销毁 TRTCCloud 实例(单例模式)
 */
liumingming authored
38 39 40
+ (void)destroySharedIntance;

/**
41 42 43 44 45
 * 1.3 设置 TRTC 事件回调
 *
 * 您可以通过 {@link TRTCCloudDelegate} 获得来自 SDK 的各类事件通知(比如:错误码,警告码,音视频状态参数等)。
 */
@property(nonatomic, weak) id<TRTCCloudDelegate> delegate;
liumingming authored
46 47

/**
48 49 50 51 52 53 54
 * 1.4 设置驱动 TRTCCloudDelegate 事件回调的队列
 *
 * 如果您不指定自己的 delegateQueue,SDK 默认会采用 MainQueue 作为驱动 {@link TRTCCloudDelegate} 事件回调的队列。
 * 也就是当您不设置 delegateQueue 属性时,{@link TRTCCloudDelegate} 中的所有回调函数都是由 MainQueue 来驱动的。
 * @note 如果您指定了自己的 delegateQueue,请不要在 {@link TRTCCloudDelegate} 回调函数中操作 UI,否则会引发线程安全问题。
 */
@property(nonatomic, strong) dispatch_queue_t delegateQueue;
liumingming authored
55 56 57 58

/// @}
/////////////////////////////////////////////////////////////////////////////////
//
59
//                    房间相关接口函数
liumingming authored
60 61 62 63 64 65
//
/////////////////////////////////////////////////////////////////////////////////
/// @name 房间相关接口函数
/// @{

/**
66
 * 2.1 进入房间
liumingming authored
67
 *
68 69
 * TRTC 的所有用户都需要进入房间才能“发布”或“订阅”音视频流,“发布”是指将自己的音频和视频推送到云端,“订阅”是指从云端拉取房间里其他用户的音视频流。
 * 调用该接口时,您需要指定您的应用场景 {@link TRTCAppScene} 以获取最佳的音视频传输体验,这些场景可以分成两大类:
liumingming authored
70
 *
71 72 73 74 75
 * 【直播场景(Live)】
 *  - 包括 {@link TRTCAppSceneLIVE} 和 {@link TRTCAppSceneVoiceChatRoom}:
 *  - 此类场景下,每一个房间最多同时容纳 10 万人,但需要您通过 {@link TRTCParams} 中的 “role” 字段设定用户是“主播”({@link TRTCRoleAnchor})还是“观众”({@link TRTCRoleAudience})。
 *  - 主播可以“发布”自己的音视频流,观众只能“订阅”别人的音视频流,每一个用户都可以在主播和观众两种角色间通过 {@link switchRole} 接口进行切换。
 *  - 适用于[视频低延时直播]、[十万人互动课堂]、[直播PK]、[音乐直播间]、[在线K歌]、[远程培训]、[超大型会议]等业务形态。
liumingming authored
76
 *
77 78 79 80
 * 【实时场景(RTC)】
 *  - 包括 {@link TRTCAppSceneVideoCall} 和 {@link TRTCAppSceneAudioCall}:
 *  - 此类场景下,每一个房间最多同时容纳 300 人在线,最高支持 50 人同时发言。
 *  - 适用于 [1对1视频通话]、[300人视频会议]、[在线问诊]、[语音聊天]、[教育小班课]、[远程面试]、[在线狼人杀]等业务形态。
liumingming authored
81
 *
82 83 84
 * 调用该接口后,您会收到来自 {@link TRTCCloudDelegate} 中的 onEnterRoom(result) 回调:
 *  - 如果进房成功,参数 result 会是一个正数(result > 0),表示从函数调用到进入房间所花费的时间,单位是毫秒(ms)。
 *  - 如果进房失败,参数 result 会是一个负数(result < 0),表示进房失败的[错误码](https://cloud.tencent.com/document/product/647/32257)。
liumingming authored
85
 *
86 87
 * @param param 进房参数,用于指定用户的身份、角色和安全票据等信息,详情请参考  {@link TRTCParams} 。
 * @param scene 应用场景,用于指定您的业务场景,同一个房间内的所有用户需要设定相同的 {@link TRTCAppScene}。
liumingming authored
88
 * @note
89 90 91
 *   1. 同一个房间内的所有用户需要设定相同的 scene。不同的 scene 会导致偶现的异常问题。
 *   2. 当您指定参数 scene 为 {@link TRTCAppSceneLIVE} 或 {@link TRTCAppSceneVoiceChatRoom} 时,您必须通过 {@link TRTCParams} 中的 “role” 字段为当前用户设定他/她在房间中的角色。
 *   3. 请您尽量保证 {@link enterRoom} 与 {@link exitRoom} 前后配对使用,即保证”先退出前一个房间再进入下一个房间”,否则会导致很多异常问题。
liumingming authored
92 93 94 95
 */
- (void)enterRoom:(TRTCParams *)param appScene:(TRTCAppScene)scene;

/**
96
 * 2.2 离开房间
liumingming authored
97
 *
98 99 100
 * 调用该接口会让用户离开自己所在的音视频房间,并释放摄像头、麦克风、扬声器等设备资源。
 * 等资源释放完毕之后,SDK 会通过 {@link TRTCCloudDelegate} 中的 onExitRoom() 回调向您通知。
 * 如果您要再次调用  {@link enterRoom}  或者切换到其他的供应商的 SDK,建议等待 onExitRoom() 回调到来之后再执行之后的操作,以避免摄像头或麦克风被占用的问题。
liumingming authored
101 102 103 104
 */
- (void)exitRoom;

/**
105
 * 2.3 切换角色
liumingming authored
106
 *
107 108 109 110 111 112 113 114 115 116
 * 调用本接口可以实现用户在“主播”和“观众”两种角色之间来回切换。
 * 由于视频直播和语音聊天室需要支持多达10万名观众同时观看,所以设定了“只有主播才能发布自己的音视频”的规则。
 * 因此,当有些观众希望发布自己的音视频流(以便能跟主播互动)时,就需要先把自己的角色切换成“主播”。
 * 您可以在进入房间时通过 {@link TRTCParams} 中的 role 字段事先确定用户的角色,也可以在进入房间后通过 switchRole 接口动态切换角色。
 * @param role 角色,默认为“主播”:
 * - {@link TRTCRoleAnchor} :主播,可以发布自己的音视频,同一个房间里最多支持50个主播同时发布音视频。
 * - {@link TRTCRoleAudience} :观众,不能发布自己的音视频流,只能观看房间中其他主播的音视频。如果要发布自己的音视频,需要先通过 {@link switchRole} 切换成“主播”,同一个房间内同时最多可以容纳 10 万名观众。
 * @note
 * 1. 该接口仅适用于视频直播({@link TRTCAppSceneLIVE})和语音聊天室({@link TRTCAppSceneVoiceChatRoom})这两个场景。
 * 2. 如果您在 {@link enterRoom} 时指定的 scene 为 {@link TRTCAppSceneVideoCall} 或 {@link TRTCAppSceneAudioCall},请不要调用这个接口。
liumingming authored
117
 */
118
- (void)switchRole:(TRTCRoleType)role;
liumingming authored
119 120

/**
121
 * 2.4 切换房间
liumingming authored
122
 *
123 124 125
 * 使用该接口可以让用户可以快速从一个房间切换到另一个房间。
 * - 如果用户的身份是“观众”,该接口的调用效果等同于 exitRoom(当前房间) + enterRoom(新的房间)。
 * - 如果用户的身份是“主播”,该接口在切换房间的同时还会保持自己的音视频发布状态,因此在房间切换过程中,摄像头的预览和声音的采集都不会中断。
liumingming authored
126
 *
127 128
 * 该接口适用于在线教育场景中,监课老师在多个房间中进行快速切换的场景。在该场景下使用 switchRoom 可以获得比 exitRoom+enterRoom 更好的流畅性和更少的代码量。
 * 接口调用结果会通过 {@link TRTCCloudDelegate} 中的 onSwitchRoom(errCode, errMsg) 回调。
liumingming authored
129
 *
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
 * @param config 房间参数,详情请参考  {@link TRTCSwitchRoomConfig} 。
 * @note 由于对老版本 SDK 兼容的需求,参数 config 中同时包含 roomId 与 strRoomId 两个参数,这两个参数的填写格外讲究,请注意如下事项:
 *  1. 若您选用 strRoomId,则 roomId 需要填写为0。若两者都填,将优先选用 roomId。
 *  2. 所有房间需要同时使用 strRoomId 或同时使用 roomId,不可混用,否则将会出现很多预期之外的 bug。
 */
- (void)switchRoom:(TRTCSwitchRoomConfig *)config;

/**
 * 2.5 请求跨房通话
 *
 * 默认情况下,只有同一个房间中的用户之间可以进行音视频通话,不同的房间之间的音视频流是相互隔离的。
 * 但您可以通过调用该接口,将另一个房间中某个主播音视频流发布到自己所在的房间中,与此同时,该接口也会将自己的音视频流发布到目标主播的房间中。
 * 也就是说,您可以使用该接口让身处两个不同房间中的主播进行跨房间的音视频流分享,从而让每个房间中的观众都能观看到这两个主播的音视频。该功能可以用来实现主播之间的 PK 功能。
 * 跨房通话的请求结果会通过 {@link TRTCCloudDelegate} 中的 onConnectOtherRoom() 回调通知给您。
 * 例如:当房间“101”中的主播 A 通过 connectOtherRoom() 跟房间“102”中的主播 B 建立跨房通话后,
 * - 房间“101”中的用户都会收到主播 B 的 onRemoteUserEnterRoom(B) 和 onUserVideoAvailable(B,YES) 这两个事件回调,即房间“101”中的用户都可以订阅主播 B 的音视频。
 * - 房间“102”中的用户都会收到主播 A 的 onRemoteUserEnterRoom(A) 和 onUserVideoAvailable(A,YES) 这两个事件回调,即房间“102”中的用户都可以订阅主播 A 的音视频。
liumingming authored
147 148
 *
 * <pre>
149
 *                 房间 101                     房间 102
liumingming authored
150 151 152 153 154
 *               -------------               ------------
 *  跨房通话前:| 主播 A      |             | 主播 B     |
 *              | 观众 U V W  |             | 观众 X Y Z |
 *               -------------               ------------
 *
155
 *                 房间 101                     房间 102
liumingming authored
156 157 158 159 160
 *               -------------               ------------
 *  跨房通话后:| 主播 A B    |             | 主播 B A   |
 *              | 观众 U V W  |             | 观众 X Y Z |
 *               -------------               ------------
 * </pre>
161
 * 跨房通话的参数考虑到后续扩展字段的兼容性问题,暂时采用了 JSON 格式的参数:
liumingming authored
162
 *
163 164 165
 * 【情况一:数字房间号】
 * 如果房间“101”中的主播 A 要跟房间“102”中的主播 B 连麦,那么主播 A 调用该接口时需要传入:{"roomId": 102, "userId": "userB"}
 * 示例代码如下:
liumingming authored
166
 * <pre>
167 168
 *   NSMutableDictionaryjsonDict = [[NSMutableDictionary alloc] init];
 *   [jsonDict setObject:@(102) forKey:@"roomId"];
liumingming authored
169 170 171 172 173 174
 *   [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];
 * </pre>
 *
175 176 177 178 179 180 181 182 183 184 185
 * 【情况二:字符串房间号】
 * 如果您使用的是字符串房间号,务必请将 json 中的 “roomId” 替换成 “strRoomId”: {"strRoomId": "102", "userId": "userB"}
 * 示例代码如下:
 * <pre>
 *   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];
 * </pre>
liumingming authored
186
 *
187 188
 * @param param 需要你传入 JSON 格式的字符串参数,roomId 代表数字格式的房间号,strRoomId 代表字符串格式的房间号,userId 代表目标主播的用户ID。
 */
liumingming authored
189 190 191
- (void)connectOtherRoom:(NSString *)param;

/**
192
 * 2.6 退出跨房通话
liumingming authored
193
 *
194 195
 * 退出结果会通过 {@link TRTCCloudDelegate} 中的 onDisconnectOtherRoom() 回调通知给您。
 */
liumingming authored
196 197 198
- (void)disconnectOtherRoom;

/**
199
 * 2.7 设置订阅模式(需要在进入房前设置才能生效)
liumingming authored
200
 *
201 202
 * 您可以通过该接口在“自动订阅”和“手动订阅”两种模式下进行切换:
 * - 自动订阅:默认模式,用户在进入房间后会立刻接收到该房间中的音视频流,音频会自动播放,视频会自动开始解码(依然需要您通过 startRemoteView 接口绑定渲染控件)。
wangguolei authored
203
 * - 手动订阅:在用户进入房间后,需要手动调用 {@startRemoteView} 接口才能启动视频流的订阅和解码,需要手动调用 {@muteRemoteAudio} (NO) 接口才能启动声音的播放。
liumingming authored
204
 *
205 206
 * 在绝大多数场景下,用户进入房间后都会订阅房间中所有主播的音视频流,因此 TRTC 默认采用了自动订阅模式,以求得最佳的“秒开体验”。
 * 如果您的应用场景中每个房间同时会有很多路音视频流在发布,而每个用户只想选择性地订阅其中的 1-2 路,则推荐使用“手动订阅”模式以节省流量费用。
wangguolei authored
207
 * @param autoRecvAudio YES:自动订阅音频;NO:需手动调用 muteRemoteAudio(NO) 订阅音频。默认值:YES。
208 209 210 211 212
 * @param autoRecvVideo YES:自动订阅视频;NO:需手动调用 startRemoteView 订阅视频。默认值:YES。
 * @note
 * 1. 需要在进入房间(enterRoom)前调用该接口,设置才能生效。
 * 2. 在自动订阅模式下,如果用户在进入房间后没有调用  {@startRemoteView} 订阅视频流,SDK 会自动停止订阅视频流,以便达到节省流量的目的。
 */
liumingming authored
213 214 215
- (void)setDefaultStreamRecvMode:(BOOL)autoRecvAudio video:(BOOL)autoRecvVideo;

/**
216 217 218 219 220 221 222 223 224 225 226 227 228
 * 2.8 创建子房间示例(用于多房间并发观看)
 *
 * TRTCCloud 一开始被设计成单例模式,限制了多房间并发观看的能力。
 * 通过调用该接口,您可以创建出多个 TRTCCloud 实例,以便同时进入多个不同的房间观看音视频流。
 * 但需要注意的是,由于摄像头和麦克风还是只有一份,因此您只能同时在一个 TRTCCloud 实例中以“主播”的身份存在,也就是您只能同时在一个 TRTCCloud 实例中发布自己的音视频流。
 * 该功能主要用于在线教育场景中一种被称为“超级小班课”的业务场景中,用于解决“每个 TRTC 的房间中最多只能有 50 人同时发布自己音视频流”的限制。
 * 示例代码如下:
 * <pre>
 *     TRTCCloud *mainCloud = [TRTCCloud sharedInstance];
 *     [mainCloud enterRoom:params1 appScene:TRTCAppSceneLIVE)];
 *     //...
 *     //Switch the role from "anchor" to "audience" in your own room
 *     [mainCloud switchRole:TRTCRoleAudience];
wangguolei authored
229 230
 *     [mainCloud muteLocalVideo:YES];
 *     [mainCloud muteLocalAudio:YES];
231 232 233 234 235
 *     //...
 *     //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];
wangguolei authored
236 237
 *     [subCloud muteLocalVideo:NO];
 *     [subCloud muteLocalAudio:NO];
238 239 240 241 242 243 244 245 246 247 248 249
 *     //...
 *     //Exit from new room and release it.
 *     [subCloud exitRoom];
 *     [mainCloud destroySubCloud:subCloud];
 * </pre>
 *
 * @note
 * - 同一个用户,可以使用同一个 userId 进入多个不同 roomId 的房间。
 * - 两台不同的终端设备不可以同时使用同一个 userId 进入同一个 roomId 的房间。
 * - 同一个用户,同时只能在一个 TRTCCloud 实例中推流,在不同房间同时推流会引发云端的状态混乱,导致各种 bug。
 * - 通过 createSubCloud 接口创建出来的 TRTCCloud 实例有一个能力限制:不能调用子实例中与本地音视频相关的接口(除 switchRole、muteLocalVideo 和 muteLocalAudio 之外), 设置美颜等接口请使用原 TRTCCloud 实例对象。
 * @return 子 TRTCCloud 实例
liumingming authored
250
 */
251
- (TRTCCloud *)createSubCloud;
liumingming authored
252 253

/**
254
 * 2.9 销毁子房间示例
liumingming authored
255
 *
256
 * @param subCloud
liumingming authored
257
 */
258
- (void)destroySubCloud:(TRTCCloud *)subCloud;
liumingming authored
259 260 261

/////////////////////////////////////////////////////////////////////////////////
//
262
//                    CDN 相关接口函数
liumingming authored
263 264 265 266
//
/////////////////////////////////////////////////////////////////////////////////

/**
267
 * 3.1 开始向腾讯云直播 CDN 上发布音视频流
liumingming authored
268
 *
269 270 271
 * 该接口会向 TRTC 服务器发送指令,要求其将当前用户的音视频流旁路到直播 CDN 上。
 * 您可以通过参数 streamId 设定直播流的 StreamId,从而可以指定该用户的音视频流对应在直播 CDN 上的播放地址。
 * 例如:您可以通过该接口将当前用户的直播流 ID 指定为 user_stream_001,那么该用户音视频流对应的 CDN 播放地址为:
liumingming authored
272
 * “http://yourdomain/live/user_stream_001.flv”,其中 yourdomain 为您自己备案的播放域名,
273
 * 您可以在[直播控制台](https://console.cloud.tencent.com/live) 配置您的播放域名,腾讯云不提供默认的播放域名。
liumingming authored
274
 * <pre>
275 276 277 278 279
 * TRTCCloud *trtcCloud = [TRTCCloud sharedInstance];
 * [trtcCloud enterRoom:params appScene:TRTCAppSceneLIVE];
 * [trtcCloud startLocalPreview:frontCamera view:localView];
 * [trtcCloud startLocalAudio];
 * [trtcCloud startPublishing: @"user_stream_001" type:TRTCVideoStreamTypeBig];
liumingming authored
280 281 282 283
 * </pre>
 *
 * 您也可以在设置 enterRoom 的参数 TRTCParams 时指定 streamId, 而且我们更推荐您采用这种方案。
 * @param streamId 自定义流 ID。
284 285 286 287 288 289
 * @param streamType 仅支持 {@link TRTCVideoStreamTypeBig} 和 {@link TRTCVideoStreamTypeSub}。
 * @note 您需要提前在 [实时音视频控制台](https://console.cloud.tencent.com/trtc/) 中的功能配置页面上开启“启用旁路推流”才能生效。
 *   - 若您选择“指定流旁路”,则您可以通过该接口将对应音视频流推送到腾讯云 CDN 且指定为填写的流 ID。
 *   - 若您选择“全局自动旁路”,则您可以通过该接口调整默认的流 ID。
 */
- (void)startPublishing:(NSString *)streamId type:(TRTCVideoStreamType)streamType;
liumingming authored
290 291

/**
292
 * 3.2 停止向腾讯云直播 CDN 上发布音视频流
liumingming authored
293 294 295 296
 */
- (void)stopPublishing;

/**
297
 * 3.3 开始向非腾讯云 CDN 上发布音视频流
liumingming authored
298
 *
299 300 301 302 303
 * 该接口跟 startPublishing 功能类似,不同之处在于,startPublishing 仅支持向腾讯云的 CDN 发布,而本接口支持向非腾讯云的直播 CDN 上转推音视频流。
 * @param param CDN 转推参数,详情请参考 {@link TRTCPublishCDNParam}
 * @note
 * - 使用 startPublishing 接口向腾讯云的直播 CDN 上发布音视频流不会收取额外费用
 * - 使用 startPublishCDNStream 接口向非腾讯云的直播 CDN 上发布音视频流,需要收取额外的转推带宽费用。
liumingming authored
304
 */
305
- (void)startPublishCDNStream:(TRTCPublishCDNParam *)param;
liumingming authored
306 307

/**
308
 * 3.4 停止向非腾讯云 CDN 上发布音视频流
liumingming authored
309 310 311 312
 */
- (void)stopPublishCDNStream;

/**
313
 * 3.5 设置云端混流的排版布局和转码参数
liumingming authored
314
 *
315 316 317 318
 * 在一个直播间中可能同时会有多个主播发布自己的音视频流,但对于直播 CDN 上的观众而言,只需要观看一条 HTTP-FLV 或 HLS 格式的视频流即可。
 * 当您调用本接口函数时,SDK 会向腾讯云的 TRTC 混流服务器发送一条指令,混流服务器会将房间里的多路音视频流混合成一路。
 * 您可以通过 {@link TRTCTranscodingConfig} 参数来调整每一路画面的排版布局,也可以设置混合后的音视频流的各项编码参数。
 * 参考文档:[云端混流转码](https://cloud.tencent.com/document/product/647/16827)。
liumingming authored
319
 * <pre>
320 321 322 323 324 325 326 327 328 329 330
 *     【画面1】=> 解码 ====> \\
 *                             \\
 *     【画面2】=> 解码 =>  画面混合 => 编码 => 【混合后的画面】
 *                             //
 *     【画面3】=> 解码 ====> //
 *
 *     【声音1】=> 解码 ====> \\
 *                             \\
 *     【声音2】=> 解码 =>  声音混合 => 编码 => 【混合后的声音】
 *                             //
 *     【声音3】=> 解码 ====> //
liumingming authored
331
 * </pre>
332
 * @param config 如果 config 不为空,则开启云端混流,如果 config 为空则停止云端混流。详情请参考 {@link TRTCTranscodingConfig} 。
liumingming authored
333
 * @note 关于云端混流的注意事项:
334 335 336 337
 *   - 调用该接口的用户,如果没设定 config 参数中的 streamId 字段,TRTC 会将房间中的多路画面混合到当前用户所对应的音视频流上,即 A + B => A。
 *   - 调用该接口的用户,如果设定了 config 参数中的 streamId 字段,TRTC 会将房间中的多路画面混合到您指定的 streamId 上,即 A + B => streamId。
 *   - 请注意,若您还在房间中且不再需要混流,请务必再次调用本接口并将 config 设置为空以进行取消,不及时取消混流可能会引起不必要的计费损失。
 *   - 请放心,当您退房时 TRTC 会自动取消混流状态。
liumingming authored
338
 */
339
- (void)setMixTranscodingConfig:(TRTCTranscodingConfig *)config;
liumingming authored
340 341 342 343

/// @}
/////////////////////////////////////////////////////////////////////////////////
//
344
//                    视频相关接口函数
liumingming authored
345 346
//
/////////////////////////////////////////////////////////////////////////////////
347
/// @name  视频相关接口函数
liumingming authored
348 349 350
/// @{

/**
351
 * 4.1 开启本地摄像头的预览画面(移动端)
liumingming authored
352 353 354
 *
 * 在 enterRoom 之前调用此函数,SDK 只会开启摄像头,并一直等到您调用 enterRoom 之后才开始推流。
 * 在 enterRoom 之后调用此函数,SDK 会开启摄像头并自动开始视频推流。
355
 * 当开始渲染首帧摄像头画面时,您会收到 {@link TRTCCloudDelegate} 中的 onCameraDidReady 回调通知。
liumingming authored
356 357
 * @param frontCamera YES:前置摄像头;NO:后置摄像头。
 * @param view 承载视频画面的控件
358 359
 * @note 如果希望开播前预览摄像头画面并通过 BeautyManager 调节美颜参数,您可以:
 *  - 方案一:在调用 enterRoom 之前调用 startLocalPreview
wangguolei authored
360
 *  - 方案二:在调用 enterRoom 之后调用 startLocalPreview + muteLocalVideo(YES)
liumingming authored
361
 */
362
#if TARGET_OS_IPHONE
liumingming authored
363
- (void)startLocalPreview:(BOOL)frontCamera view:(TXView *)view;
364 365
#endif
liumingming authored
366
/**
367
 * 4.2 开启本地摄像头的预览画面(桌面端)
liumingming authored
368
 *
369
 * 在调用该接口之前,您可以先调用 setCurrentCameraDevice 选择使用 Mac 自带摄像头或外接摄像头。
liumingming authored
370 371
 * 在 enterRoom 之前调用此函数,SDK 只会开启摄像头,并一直等到您调用 enterRoom 之后才开始推流。
 * 在 enterRoom 之后调用此函数,SDK 会开启摄像头并自动开始视频推流。
372
 * 当开始渲染首帧摄像头画面时,您会收到 {@link TRTCCloudDelegate}  中的 onCameraDidReady 回调通知。
liumingming authored
373
 * @param view 承载视频画面的控件
374 375
 * @note 如果希望开播前预览摄像头画面并通过 BeautyManager 调节美颜参数,您可以:
 * - 方案一:在调用 enterRoom 之前调用 startLocalPreview
wangguolei authored
376
 * - 方案二:在调用 enterRoom 之后调用 startLocalPreview + muteLocalVideo(YES)
liumingming authored
377
 */
378
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
379 380 381 382
- (void)startLocalPreview:(TXView *)view;
#endif

/**
383
 * 4.3 更新本地摄像头的预览画面
liumingming authored
384 385 386 387
 */
- (void)updateLocalView:(TXView *)view;

/**
388
 * 4.4 停止摄像头预览
liumingming authored
389 390 391 392
 */
- (void)stopLocalPreview;

/**
393
 * 4.5 暂停/恢复发布本地的视频流
liumingming authored
394
 *
395 396 397 398 399 400 401
 * 该接口可以暂停(或恢复)发布本地的视频画面,暂停之后,同一房间中的其他用户将无法继续看到自己画面。
 * 该接口在指定 TRTCVideoStreamTypeBig 时等效于 start/stopLocalPreview 这两个接口,但具有更好的响应速度。
 * 因为 start/stopLocalPreview 需要打开和关闭摄像头,而打开和关闭摄像头都是硬件设备相关的操作,非常耗时。
 * 相比之下,muteLocalVideo 只需要在软件层面对数据流进行暂停或者放行即可,因此效率更高,也更适合需要频繁打开关闭的场景。
 * 当暂停/恢复发布指定 TRTCVideoStreamTypeBig 后,同一房间中的其他用户将会收到 onUserVideoAvailable 回调通知。
 * 当暂停/恢复发布指定 TRTCVideoStreamTypeSub 后,同一房间中的其他用户将会收到 onUserSubStreamAvailable 回调通知。
 * @param streamType 要暂停/恢复的视频流类型(仅支持 {@link TRTCVideoStreamTypeBig} 和 {@link TRTCVideoStreamTypeSub})
wangguolei authored
402
 * @param mute YES:暂停;NO:恢复。
liumingming authored
403
 */
404
- (void)muteLocalVideo:(TRTCVideoStreamType)streamType mute:(BOOL)mute;
liumingming authored
405 406

/**
407
 * 4.6 设置本地画面被暂停期间的替代图片
liumingming authored
408
 *
wangguolei authored
409
 * 当您调用 muteLocalVideo(YES) 暂停本地画面时,您可以通过调用本接口设置一张替代图片,设置后,房间中的其他用户会看到这张替代图片,而不是黑屏画面。
410 411
 * @param image 设置替代图片,空值代表在 muteLocalVideo 之后不再发送视频流数据,默认值为空。
 * @param fps 设置替代图片帧率,最小值为5,最大值为10,默认5。
liumingming authored
412 413 414 415
 */
- (void)setVideoMuteImage:(TXImage *)image fps:(NSInteger)fps;

/**
416
 * 4.7 订阅远端用户的视频流,并绑定视频渲染控件
liumingming authored
417
 *
418 419 420
 * 调用该接口可以让 SDK 拉取指定 userid 的视频流,并渲染到参数 view 指定的渲染控件上。您可以通过 {@link setRemoteRenderParams} 设置画面的显示模式。
 * - 如果您已经知道房间中有视频流的用户的 userid,可以直接调用 startRemoteView 订阅该用户的画面。
 * - 如果您不知道房间中有哪些用户在发布视频,您可以在 enterRoom 之后等待来自 {@link onUserVideoAvailable} 的通知。
liumingming authored
421
 *
422 423
 * 调用本接口只是启动视频流的拉取,此时画面还需要加载和缓冲,当缓冲完毕后您会收到来自 {@link onFirstVideoFrame} 的通知。
 * @param userId 指定远端用户的 ID。
liumingming authored
424
 * @param streamType 指定要观看 userId 的视频流类型:
425 426 427 428 429
 *    - 高清大画面:{@link TRTCVideoStreamTypeBig}
 *    - 低清小画面:{@link TRTCVideoStreamTypeSmall}(需要远端用户通过 {@link enableEncSmallVideoStream} 开启双路编码后才有效果)
 *    - 辅流画面(常用于屏幕分享):{@link TRTCVideoStreamTypeSub}
 *
 * @param view 用于承载视频画面的渲染控件
liumingming authored
430
 * @note 注意几点规则需要您关注:
431 432 433
 *  1. SDK 支持同时观看某 userid 的大画面和辅路画面,或者同时观看某 userid 的小画面和辅路画面,但不支持同时观看大画面和小画面。
 *  2. 只有当指定的 userid 通过 {@link enableEncSmallVideoStream} 开启双路编码后,才能观看该用户的小画面。
 *  3. 当指定的 userid 的小画面不存在时,SDK 默认切换到该用户的大画面。
liumingming authored
434 435 436 437
 */
- (void)startRemoteView:(NSString *)userId streamType:(TRTCVideoStreamType)streamType view:(TXView *)view;

/**
438 439 440 441 442 443 444 445
 * 4.8 更新远端用户的视频渲染控件
 *
 * 该接口可用于更新远端视频画面的渲染控件,常被用于切换显示区域的交互场景中。
 * @param view 承载视频画面的控件
 * @param streamType 要设置预览窗口的流类型(仅支持 {@link TRTCVideoStreamTypeBig} 和 {@link TRTCVideoStreamTypeSub})
 * @param userId 指定远端用户的 ID。
 */
- (void)updateRemoteView:(TXView *)view streamType:(TRTCVideoStreamType)streamType forUser:(NSString *)userId;
liumingming authored
446 447

/**
448
 * 4.9 停止订阅远端用户的视频流,并释放渲染控件
liumingming authored
449
 *
450 451 452 453 454 455
 * 调用此接口会让 SDK 停止接收该用户的视频流,并释放该路视频流的解码和渲染资源。
 * @param userId 指定远端用户的 ID。
 * @param streamType 指定要观看 userId 的视频流类型:
 *    - 高清大画面:{@link TRTCVideoStreamTypeBig}
 *    - 低清小画面:{@link TRTCVideoStreamTypeSmall}
 *    - 辅流画面(常用于屏幕分享):{@link TRTCVideoStreamTypeSub}
liumingming authored
456 457 458 459
 */
- (void)stopRemoteView:(NSString *)userId streamType:(TRTCVideoStreamType)streamType;

/**
460
 * 4.10 停止订阅所有远端用户的视频流,并释放全部渲染资源
liumingming authored
461
 *
462 463
 * 调用此接口会让 SDK 停止接收所有来自远端的视频流,并释放全部的解码和渲染资源。
 * @note 如果当前有正在显示的辅路画面(屏幕分享)也会一并被停止。
liumingming authored
464 465 466 467
 */
- (void)stopAllRemoteView;

/**
468
 * 4.11 暂停/恢复订阅远端用户的视频流
liumingming authored
469
 *
470 471 472 473 474
 * 该接口仅暂停/恢复接收指定用户的视频流,但并不释放显示资源,视频画面会被冻屏在接口调用时的最后一帧。
 * @param userId 指定远端用户的 ID。
 * @param streamType 要暂停/恢复的视频流类型(仅支持 {@link TRTCVideoStreamTypeBig} 和 {@link TRTCVideoStreamTypeSub})。
 * @param mute 是否暂停接收。
 * @note 该接口支持您在进入房间(enterRoom)前调用,暂停状态会在退出房间(exitRoom)在之后会被重置。
liumingming authored
475
 */
476
- (void)muteRemoteVideoStream:(NSString *)userId streamType:(TRTCVideoStreamType)streamType mute:(BOOL)mute;
liumingming authored
477 478

/**
479
 * 4.12 暂停/恢复订阅所有远端用户的视频流
liumingming authored
480
 *
481 482 483
 * 该接口仅暂停/恢复接收所有用户的视频流,但并不释放显示资源,视频画面会被冻屏在接口调用时的最后一帧。
 * @param mute  是否暂停接收
 * @note 该接口支持您在进入房间(enterRoom)前调用,暂停状态会在退出房间(exitRoom)在之后会被重置。
liumingming authored
484 485 486 487
 */
- (void)muteAllRemoteVideoStreams:(BOOL)mute;

/**
488
 * 4.13 设置视频编码器的编码参数
liumingming authored
489
 *
490 491
 * 该设置能够决定远端用户看到的画面质量,同时也能决定云端录制出的视频文件的画面质量。
 * @param param 用于设置视频编码器的相关参数,详情请参考 {@link TRTCVideoEncParam}。
liumingming authored
492
 */
493
- (void)setVideoEncoderParam:(TRTCVideoEncParam *)param;
liumingming authored
494 495

/**
496
 * 4.14 设置网络质量控制的相关参数
liumingming authored
497
 *
498 499
 * 该设置决定在差网络环境下的质量调控策略,如“画质优先”或“流畅优先”等策略。
 * @param param 用于设置网络质量控制的相关参数,详情请参考 {@link TRTCNetworkQosParam}。
liumingming authored
500
 */
501
- (void)setNetworkQosParam:(TRTCNetworkQosParam *)param;
liumingming authored
502 503

/**
504
 * 4.15 设置本地画面的渲染参数
liumingming authored
505
 *
506 507
 * 可设置的参数包括有:画面的旋转角度、填充模式以及左右镜像等。
 * @param params 画面渲染参数,详情请参考 {@link TRTCRenderParams}。
liumingming authored
508 509 510 511
 */
- (void)setLocalRenderParams:(TRTCRenderParams *)params;

/**
512
 * 4.16 设置远端画面的渲染模式
liumingming authored
513
 *
514 515 516 517
 * 可设置的参数包括有:画面的旋转角度、填充模式以及左右镜像等。
 * @param userId 指定远端用户的 ID。
 * @param streamType 可以设置为主路画面(TRTCVideoStreamTypeBig)或辅路画面(TRTCVideoStreamTypeSub)
 * @param params 画面渲染参数,详情请参考 {@link TRTCRenderParams}。
liumingming authored
518
 */
519
- (void)setRemoteRenderParams:(NSString *)userId streamType:(TRTCVideoStreamType)streamType params:(TRTCRenderParams *)params;
liumingming authored
520 521

/**
522
 * 4.17 设置视频编码器输出的画面方向
liumingming authored
523
 *
524 525 526 527 528
 * 该设置不影响本地画面的预览方向,但会影响房间中其他用户所观看到(以及云端录制文件)的画面方向。
 * 当用户将手机或 Pad 上下颠倒时,由于摄像头的采集方向没有变,所以房间中其他用户所看到的画面会变成上下颠倒的,
 * 在这种情况下,您可以通过调用该接口将 SDK 编码出的画面方向旋转180度,如此一来,房间中其他用户所看到的画面可保持正常的方向。
 * 如果您希望实现上述这种友好的交互体验,我们更推荐您直接调用 {@link setGSensorMode} 实现更加智能的方向适配,无需您手动调用本接口。
 * @param rotation 目前支持0和180两个旋转角度,默认值:TRTCVideoRotation_0,即不旋转。
liumingming authored
529 530 531 532
 */
- (void)setVideoEncoderRotation:(TRTCVideoRotation)rotation;

/**
533
 * 4.18 设置编码器输出的画面镜像模式
liumingming authored
534
 *
535
 * 该设置不影响本地画面的镜像模式,但会影响房间中其他用户所观看到(以及云端录制文件)的镜像模式。
wangguolei authored
536
 * @param mirror 是否开启远端镜像,YES:开启远端画面镜像;NO:关闭远端画面镜像,默认值:NO。
liumingming authored
537 538 539 540
 */
- (void)setVideoEncoderMirror:(BOOL)mirror;

/**
541
 * 4.19 设置重力感应的适配模式
liumingming authored
542
 *
543 544 545 546
 * 您可以通过本接口实现如下这种友好的交互体验:
 * 当用户将手机或 Pad 上下颠倒时,由于摄像头的采集方向没有变,所以房间中其他用户所看到的画面会变成上下颠倒的,
 * 在这种情况下,您可以通过调用该接口让 SDK 根据设备陀螺仪的朝向自动调整本地画面和编码器输出画面的旋转方向,以使远端观众可以看到正常朝向的画面。
 * @param mode 重力感应模式,详情请参考 {@link TRTCGSensorMode},默认值:TRTCGSensorMode_UIAutoLayout。
liumingming authored
547
 */
548
- (void)setGSensorMode:(TRTCGSensorMode)mode;
liumingming authored
549 550

/**
551
 * 4.20 开启大小画面双路编码模式
liumingming authored
552
 *
553 554 555
 * 开启双路编码模式后,当前用户的编码器会同时输出【高清大画面】和【低清小画面】两路视频流(但只有一路音频流)。
 * 如此以来,房间中的其他用户就可以根据自身的网络情况或屏幕大小选择订阅【高清大画面】或是【低清小画面】。
 * @note 双路编码开启后,会消耗更多的 CPU 和 网络带宽,所以 Mac、Windows 或者高性能 Pad 可以考虑开启,不建议手机端开启。
wangguolei authored
556
 * @param enable 是否开启小画面编码,默认值:NO
liumingming authored
557
 * @param smallVideoEncParam 小流的视频参数
558
 * @return 0:成功;-1:当前大画面已被设置为较低画质,开启双路编码已无必要。
liumingming authored
559
 */
560
- (int)enableEncSmallVideoStream:(BOOL)enable withQuality:(TRTCVideoEncParam *)smallVideoEncParam;
liumingming authored
561 562

/**
563 564 565 566 567 568 569 570 571
 * 4.21 切换指定远端用户的大小画面
 *
 * 当房间中某个主播开启了双路编码之后,房间中其他用户通过 {@link startRemoteView} 订阅到的画面默认会是【高清大画面】。
 * 您可以通过此接口选定希望订阅的画面是大画面还是小画面,该接口在 {@link startRemoteView} 之前和之后调用均可生效。
 * @note 此功能需要目标用户已经通过 {@link enableEncSmallVideoStream} 提前开启了双路编码模式,否则此调用无实际效果。
 * @param userId 指定远端用户的 ID。
 * @param streamType 视频流类型,即选择看大画面还是小画面,默认为大画面。
 */
- (void)setRemoteVideoStreamType:(NSString *)userId type:(TRTCVideoStreamType)streamType;
liumingming authored
572
573 574 575 576 577 578 579 580 581 582
/**
 * 4.22 视频画面截图
 *
 * 您可以通过本接口截取本地的视频画面,远端用户的主路画面以及远端用户的辅路(屏幕分享)画面。
 * @param userId 用户 ID,如指定空置表示截取本地的视频画面。
 * @param streamType 视频流类型,可选择截取主路画面({@link TRTCVideoStreamTypeBig},常用于摄像头)或辅路画面({@link TRTCVideoStreamTypeSub},常用于屏幕分享)。
 * @param sourceType 画面来源,可选择截取视频流画面({@link TRTCSnapshotSourceTypeStream})或视频渲染画面({@link TRTCSnapshotSourceTypeView}),前者一般更清晰。
 * @note Windows 平台目前仅支持截取 {@link TRTCSnapshotSourceTypeStream} 来源的视频画面。
 */
- (void)snapshotVideo:(NSString *)userId type:(TRTCVideoStreamType)streamType sourceType:(TRTCSnapshotSourceType)sourceType completionBlock:(void (^)(TXImage *image))completionBlock;
liumingming authored
583
584
/// @}
liumingming authored
585 586
/////////////////////////////////////////////////////////////////////////////////
//
587
//                    音频相关接口函数
liumingming authored
588 589
//
/////////////////////////////////////////////////////////////////////////////////
590
/// @name  音频相关接口函数
liumingming authored
591 592 593
/// @{

/**
594
 * 5.1 开启本地音频的采集和发布
liumingming authored
595
 *
596
 * SDK 默认不开启麦克风,当用户需要发布本地音频时,需要调用该接口开启麦克风采集,并将音频编码并发布到当前的房间中。
wangguolei authored
597
 * 开启本地音频的采集和发布后,房间中的其他用户会收到 {@link onUserAudioAvailable}(userId, YES) 的通知。
liumingming authored
598
 * @param quality 声音音质
599 600 601 602
 *   - {@link TRTCAudioQualitySpeech},流畅:采样率:16k;单声道;音频裸码率:16kbps;适合语音通话为主的场景,比如在线会议,语音通话。
 *   - {@link TRTCAudioQualityDefault},默认:采样率:48k;单声道;音频裸码率:50kbps;SDK 默认的音频质量,如无特殊需求推荐选择之。
 *   - {@link TRTCAudioQualityMusic},高音质:采样率:48k;双声道 + 全频带;音频裸码率:128kbps;适合需要高保真传输音乐的场景,比如在线K歌、音乐直播等。
 * @note 该函数会检查麦克风的使用权限,如果当前 App 没有麦克风权限,SDK 会自动向用户申请麦克风使用权限。
liumingming authored
603 604 605 606
 */
- (void)startLocalAudio:(TRTCAudioQuality)quality;

/**
607
 * 5.2 停止本地音频的采集和发布
liumingming authored
608
 *
wangguolei authored
609
 * 停止本地音频的采集和发布后,房间中的其他用户会收到 {@link onUserAudioAvailable}(userId, NO) 的通知。
liumingming authored
610 611 612 613
 */
- (void)stopLocalAudio;

/**
614
 * 5.3 暂停/恢复发布本地的音频流
liumingming authored
615
 *
wangguolei authored
616 617 618
 * 当您暂停发布本地音频流之后,房间中的其他他用户会收到 {@link onUserAudioAvailable}(userId, NO) 的通知。
 * 当您恢复发布本地音频流之后,房间中的其他他用户会收到 {@link onUserAudioAvailable}(userId, YES) 的通知。
 * 与 {@link stopLocalAudio} 的不同之处在于,muteLocalAudio(YES) 并不会释放麦克风权限,而是继续发送码率极低的静音包。
619 620
 * 这对于需要云端录制的场景非常适用,因为 MP4 等格式的视频文件,对于音频数据的连续性要求很高,使用 {@link stopLocalAudio} 会导致录制出的 MP4 文件不易播放。
 * 因此在对录制文件的质量要求较高的场景中,建议选择 muteLocalAudio 而不建议使用 stopLocalAudio。
wangguolei authored
621
 * @param mute YES:静音;NO:恢复。
liumingming authored
622 623 624 625
 */
- (void)muteLocalAudio:(BOOL)mute;

/**
626
 * 5.4 暂停/恢复播放远端的音频流
liumingming authored
627
 *
628 629
 * 当您静音某用户的远端音频时,SDK 会停止播放指定用户的声音,同时也会停止拉取该用户的音频数据数据。
 * @param userId 用于指定远端用户的 ID。
wangguolei authored
630 631
 * @param mute YES:静音;NO:取消静音。
 * @note 在进入房间(enterRoom)之前或之后调用本接口均生效,静音状态在退出房间(exitRoom) 之后会被重置为 NO。
liumingming authored
632 633 634 635
 */
- (void)muteRemoteAudio:(NSString *)userId mute:(BOOL)mute;

/**
636
 * 5.5 暂停/恢复播放所有远端用户的音频流
liumingming authored
637
 *
638
 * 当您静音所有用户的远端音频时,SDK 会停止播放所有来自远端的音频流,同时也会停止拉取所有用户的音频数据。
wangguolei authored
639 640
 * @param mute YES:静音;NO:取消静音。
 * @note 在进入房间(enterRoom)之前或之后调用本接口均生效,静音状态在退出房间(exitRoom) 之后会被重置为 NO。
liumingming authored
641 642 643 644
 */
- (void)muteAllRemoteAudio:(BOOL)mute;

/**
645
 * 5.6 设置音频路由
liumingming authored
646
 *
647 648 649 650 651
 * 设置“音频路由”,即设置声音是从手机的扬声器还是从听筒中播放出来,因此该接口仅适用于手机等移动端设备。
 * 手机有两个扬声器:一个是位于手机顶部的听筒,一个是位于手机底部的立体声扬声器。
 * 设置音频路由为听筒时,声音比较小,只有将耳朵凑近才能听清楚,隐私性较好,适合用于接听电话。
 * 设置音频路由为扬声器时,声音比较大,不用将手机贴脸也能听清,因此可以实现“免提”的功能。
 * @param route 音频路由,即声音由哪里输出(扬声器、听筒),默认值:TRTCAudioModeSpeakerphone。
liumingming authored
652 653 654 655
 */
- (void)setAudioRoute:(TRTCAudioRoute)route;

/**
656
 * 5.7 设定某一个远端用户的声音播放音量
liumingming authored
657
 *
658 659 660 661
 * 您可以通过 setRemoteAudioVolume(userId, 0) 将某一个远端用户的声音静音。
 * @param userId 用于指定远端用户的 ID。
 * @param volume 音量大小,取值范围为0 - 100,默认值:100。
 * @note 如果将 volume 设置成 100 之后感觉音量还是太小,可以将 volume 最大设置成 150,但超过 100 的 volume 会有爆音的风险,请谨慎操作。
liumingming authored
662 663 664 665
 */
- (void)setRemoteAudioVolume:(NSString *)userId volume:(int)volume;

/**
666
 * 5.8 设定本地音频的采集音量
liumingming authored
667
 *
668 669
 * @param volume 音量大小,取值范围为0 - 100;默认值:100
 * @note 如果将 volume 设置成 100 之后感觉音量还是太小,可以将 volume 最大设置成 150,但超过 100 的 volume 会有爆音的风险,请谨慎操作。
liumingming authored
670 671 672 673
 */
- (void)setAudioCaptureVolume:(NSInteger)volume;

/**
674
 * 5.9 获取本地音频的采集音量
liumingming authored
675 676 677 678
 */
- (NSInteger)getAudioCaptureVolume;

/**
679
 * 5.10 设定远端音频的播放音量
liumingming authored
680
 *
681
 * 该接口会控制 SDK 最终交给系统播放的声音音量,调节效果会影响到本地音频录制文件的音量大小,但不会影响到耳返的音量大小。
liumingming authored
682
 *
683 684
 * @param volume 音量大小,取值范围为0 - 100,默认值:100。
 * @note 如果将 volume 设置成 100 之后感觉音量还是太小,可以将 volume 最大设置成 150,但超过 100 的 volume 会有爆音的风险,请谨慎操作。
liumingming authored
685 686 687 688
 */
- (void)setAudioPlayoutVolume:(NSInteger)volume;

/**
689
 * 5.11 获取远端音频的播放音量
liumingming authored
690 691 692 693
 */
- (NSInteger)getAudioPlayoutVolume;

/**
694
 * 5.12 启用音量大小提示
liumingming authored
695
 *
696 697 698
 * 开启此功能后,SDK 会在 {@link TRTCCloudDelegate} 中的 {@link onUserVoiceVolume} 回调中反馈远端音频的音量大小。
 * @note 如需打开此功能,请在 startLocalAudio 之前调用才可以生效。
 * @param interval 设置 onUserVoiceVolume 回调的触发间隔,单位为ms,最小间隔为100ms,如果小于等于 0 则会关闭回调,建议设置为300ms;
liumingming authored
699 700 701 702
 */
- (void)enableAudioVolumeEvaluation:(NSUInteger)interval;

/**
703
 * 5.13 开始录音
liumingming authored
704
 *
705 706 707 708
 * 当您调用改接口后, SDK 会将本地和远端的所有音频(包括本地音频,远端音频,背景音乐和音效等)混合并录制到一个本地文件中。
 * 该接口在进入房间前后调用均可生效,如果录制任务在退出房间前尚未通过 stopAudioRecording 停止,则退出房间后录制任务会自动被停止。
 * @param param 录音参数,请参考 {@link TRTCAudioRecordingParams}
 * @return 0:成功;-1:录音已开始;-2:文件或目录创建失败;-3:后缀指定的音频格式不支持。
liumingming authored
709
 */
710
- (int)startAudioRecording:(TRTCAudioRecordingParams *)param;
liumingming authored
711 712

/**
713
 * 5.14 停止录音
liumingming authored
714
 *
715
 * 如果录制任务在退出房间前尚未通过本接口停止,则退出房间后录音任务会自动被停止。
liumingming authored
716 717 718 719
 */
- (void)stopAudioRecording;

/**
720
 * 5.15 开启本地媒体录制
liumingming authored
721
 *
722 723
 * 开启后把直播过程中的音视和视频内容录制到本地的一个文件中。
 * @param params 录制参数,请参考 {@link TRTCLocalRecordingParams}
liumingming authored
724 725 726 727
 */
- (void)startLocalRecording:(TRTCLocalRecordingParams *)params;

/**
728
 * 5.16 停止本地媒体录制
liumingming authored
729
 *
730
 * 如果录制任务在退出房间前尚未通过本接口停止,则退出房间后录音任务会自动被停止。
liumingming authored
731
 */
732
- (void)stopLocalRecording;
liumingming authored
733
wangguolei authored
734 735 736 737 738 739 740 741
/**
 * 5.18 设置远端音频流智能并发播放策略
 *
 * 设置远端音频流智能并发播放策略,适用于上麦人数比较多的场景。
 * @param params 音频并发参数,请参考 {@link TRTCAudioParallelParams}
 */
- (void)setRemoteAudioParallelParams:(TRTCAudioParallelParams *)params;
liumingming authored
742 743 744
/// @}
/////////////////////////////////////////////////////////////////////////////////
//
745
//                    设备管理相关接口
liumingming authored
746 747
//
/////////////////////////////////////////////////////////////////////////////////
748
/// @name  设备管理相关接口
liumingming authored
749 750 751
/// @{

/**
752
 * 6.1 获取设备管理类(TXDeviceManager)
liumingming authored
753 754 755
 */
- (TXDeviceManager *)getDeviceManager;
756
/// @}
liumingming authored
757 758
/////////////////////////////////////////////////////////////////////////////////
//
759
//                    美颜特效和图像水印
liumingming authored
760 761
//
/////////////////////////////////////////////////////////////////////////////////
762
/// @name  美颜特效和图像水印
liumingming authored
763 764 765
/// @{

/**
766
 * 7.1 获取美颜管理类(TXBeautyManager)
liumingming authored
767 768
 *
 * 通过美颜管理,您可以使用以下功能:
769 770 771 772 773
 * - 设置"磨皮"、“美白”、“红润”等美颜特效。
 * - 设置“大眼”、“瘦脸”、“V脸”、“下巴”、“短脸”、“小鼻”、“亮眼”、“白牙”、“祛眼袋”、“祛皱纹”、“祛法令纹”等修脸特效。
 * - 设置“发际线”、“眼间距”、“眼角”、“嘴形”、“鼻翼”、“鼻子位置”、“嘴唇厚度”、“脸型”等修脸特效。
 * - 设置"眼影"、“腮红”等美妆特效。
 * - 设置动态贴纸和人脸挂件等动画特效。
liumingming authored
774 775 776 777
 */
- (TXBeautyManager *)getBeautyManager;

/**
778
 * 7.2 添加水印
liumingming authored
779
 *
780
 * 水印的位置是通过 rect 参数来指定的,rect 是一个四元组参数,其格式为 (x,y,width,height)
liumingming authored
781 782 783 784 785
 * - x:水印的坐标,取值范围为0 - 1的浮点数。
 * - y:水印的坐标,取值范围为0 - 1的浮点数。
 * - width:水印的宽度,取值范围为0 - 1的浮点数。
 * - height:是不用设置的,SDK 内部会根据水印图片的宽高比自动计算一个合适的高度。
 *
786 787 788
 * 参数设置举例:
 * 如果当前视频的编码分辨率是 540 × 960,且 rect 参数被您设置为(0.1,0.1,0.2,0.0),
 * 那么水印的左上坐标点就是(540 × 0.1,960 × 0.1)即(54,96),水印的宽度是 540 × 0.2 = 108px,水印的高度会根据水印图片的宽高比由 SDK 自动算出。
liumingming authored
789
 *
790 791
 * @param image 水印图片,**必须使用透明底色的 png 格式**
 * @param streamType 指定给哪一路画面设置水印,详情请参考{@link TRTCVideoStreamType}。
liumingming authored
792
 * @param rect 水印相对于编码分辨率的归一化坐标,x,y,width,height 取值范围0 - 1。
793
 * @note 如果您要给主画面(一般为摄像头)和辅路画面(一般用作屏幕分享)同时设置水印,需要调用该接口两次,并设定不同的 streamType。
liumingming authored
794
 */
795
- (void)setWatermark:(TXImage *)image streamType:(TRTCVideoStreamType)streamType rect:(CGRect)rect;
liumingming authored
796 797 798 799

/// @}
/////////////////////////////////////////////////////////////////////////////////
//
800
//                    背景音乐和声音特效
liumingming authored
801 802
//
/////////////////////////////////////////////////////////////////////////////////
803
/// @name  背景音乐和声音特效
liumingming authored
804 805 806
/// @{

/**
807 808 809 810 811 812 813
 * 8.1 获取音效管理类(TXAudioEffectManager)
 *
 * TXAudioEffectManager 是音效管理接口,您可以通过该接口实现如下功能:
 * - 背景音乐:支持在线音乐和本地音乐,支持变速、变调等特效、支持原生和伴奏并播放和循环播放。
 * - 耳机耳返:麦克风捕捉的声音实时通过耳机播放,常用于音乐直播。
 * - 混响效果:KTV、小房间、大会堂、低沉、洪亮...
 * - 变声特效:萝莉、大叔、重金属...
wangguolei authored
814
 * - 短音效:鼓掌声、欢笑声等简短的音效文件(对于小于10秒的文件,请将 isShortFile 参数设置为 YES)。
815
 */
liumingming authored
816 817 818
- (TXAudioEffectManager *)getAudioEffectManager;

/**
819
 * 8.2 开启系统声音采集(仅适用于 Mac 系统)
liumingming authored
820
 *
821 822 823 824 825 826
 * 该接口会从电脑的声卡中采集音频数据,并将其混入到 SDK 当前的音频数据流中,从而使房间中的其他用户也能听到主播的电脑所播放出的声音。
 * 在线教育场景中,老师可以使用此功能让 SDK 采集教学影片中的声音,并广播给同房间中的学生。
 * 音乐直播场景中,主播可以使用此功能让 SDK 采集音乐播放器中的音乐,从而为自己的直播间增加背景音乐。
 * @note
 *   1. 此功能需要为用户的 Mac 系统安装虚拟音频设备插件,安装完成后,SDK 会从已经安装的虚拟音频设备中采集声音。
 *   2. SDK 会自动从网络上下载合适的插件进行安装,但是下载速度可能比较慢,如果您希望加速这个过程,可以将虚拟音频插件文件打包到您 App Bundle 的 Resources 目录下。
liumingming authored
827
 */
828 829 830
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)startSystemAudioLoopback;
#endif
liumingming authored
831 832

/**
833 834 835 836 837 838 839 840
 * 8.3 停止系统声音采集(仅适用于桌面系统)
 */
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)stopSystemAudioLoopback;
#endif

/**
 * 8.4 设置系统声音的采集音量
liumingming authored
841
 *
842
 * @param volume 设置的音量大小,范围是:[0 ~ 150],默认值为100。
liumingming authored
843
 */
844 845 846 847 848 849 850 851 852 853
- (void)setSystemAudioLoopbackVolume:(uint32_t)volume;

/// @}
/////////////////////////////////////////////////////////////////////////////////
//
//                    屏幕分享相关接口
//
/////////////////////////////////////////////////////////////////////////////////
/// @name  屏幕分享相关接口
/// @{
liumingming authored
854 855

/**
856
 * 9.1 开始应用内的屏幕分享(仅支持 iOS 13.0 及以上系统)
liumingming authored
857
 *
858 859 860 861 862 863 864
 * 该接口会抓取当前应用内的实时屏幕内容并将其分享给同房间中的其他用户,适用于 13.0 以上的 iOS 系统。
 * 如果您希望抓取整个 iOS 系统的屏幕内容(而不受当前应用的限制),推荐使用 {@link startScreenCaptureByReplaykit}。
 * iPhone 推荐的屏幕分享视频编码参数({@link TRTCVideoEncParam}):
 *  - 分辨率(videoResolution): 1280 x 720
 *  - 帧率(videoFps): 10 FPS
 *  - 码率(videoBitrate): 1600 kbps
 *  - 分辨率自适应(enableAdjustRes): NO
liumingming authored
865 866
 *
 * @param streamType 屏幕分享使用的线路,可以设置为主路(TRTCVideoStreamTypeBig)或者辅路(TRTCVideoStreamTypeSub)。
867 868
 * @param encParams 设置屏幕分享时的视频编码参数,推荐采用上述推荐配置。
 *        如果您指定 encParams 为 nil,SDK 会使用您在调用 startScreenCapture 接口之前所设置的视频编码参数。
liumingming authored
869
 */
870
#if TARGET_OS_IPHONE
liumingming authored
871
- (void)startScreenCaptureInApp:(TRTCVideoStreamType)streamType encParam:(TRTCVideoEncParam *)encParams API_AVAILABLE(ios(13.0));
872
#endif
liumingming authored
873 874

/**
875
 * 9.1 开始全系统的屏幕分享(仅支持 iOS 11.0 及以上系统)
liumingming authored
876
 *
877 878 879 880 881 882 883 884
 * 该接口支持抓取整个 iOS 系统的屏幕,可以实现类似腾讯会议的全系统级的屏幕分享。
 * 但对接步骤要比 {@link startScreenCaptureInApp} 略繁琐一些,需要为您的应用实现一个 Replaykit 扩展模块。
 * 参考文档:[实时屏幕分享(iOS)](https://cloud.tencent.com/document/product/647/45750)
 * iPhone 推荐的屏幕分享视频编码参数({@link TRTCVideoEncParam}):
 *  - 分辨率(videoResolution): 1280 x 720
 *  - 帧率(videoFps): 10 FPS
 *  - 码率(videoBitrate): 1600 kbps
 *  - 分辨率自适应(enableAdjustRes): NO
liumingming authored
885
 *
886 887 888
 * @param streamType 屏幕分享使用的线路,可以设置为主路(TRTCVideoStreamTypeBig)或者辅路(TRTCVideoStreamTypeSub)。
 * @param encParams 设置屏幕分享时的视频编码参数,推荐采用上述推荐配置。如果您指定 encParams 为 nil,SDK 会使用您在调用 startScreenCapture 接口之前所设置的视频编码参数。
 * @param appGroup 用于指定您的应用与录屏进程共享的 Application Group Identifier,您可以指定该参数为 nil,但推荐您按照文档指示进行设置,从而获得更好的可靠性。
liumingming authored
889
 */
890 891 892
#if TARGET_OS_IPHONE
- (void)startScreenCaptureByReplaykit:(TRTCVideoStreamType)streamType encParam:(TRTCVideoEncParam *)encParams appGroup:(NSString *)appGroup API_AVAILABLE(ios(11.0));
#endif
liumingming authored
893 894

/**
895
 * 9.1 开始桌面端屏幕分享(该接口仅支持桌面系统)
liumingming authored
896
 *
897 898 899
 * 该接口可以抓取整个 Mac OS 系统的屏幕内容,或抓取您指定的某个应用的窗口内容,并将其分享给同房间中的其他用户。
 * @param view 渲染控件所在的父控件,可以设置为空值,表示不显示屏幕分享的预览效果。
 * @param streamType 屏幕分享使用的线路,可以设置为主路(TRTCVideoStreamTypeBig)或者辅路(TRTCVideoStreamTypeSub),推荐使用辅路。
liumingming authored
900
 * @param encParam 屏幕分享的画面编码参数,SDK 会优先使用您通过此接口设置的编码参数:
901 902
 *   - 如果您设置 encParam 为 nil,且您已通过 setSubStreamEncoderParam 设置过辅路视频编码参数,SDK 将使用您设置过的辅路编码参数进行屏幕分享。
 *   - 如果您设置 encParam 为 nil,且您未通过 setSubStreamEncoderParam 设置过辅路视频编码参数,SDK 将自动选择一个最佳的编码参数进行屏幕分享。
liumingming authored
903
 *
904 905 906 907 908
 * @note
 * 1. 同一个用户同时最多只能发布一路主路({@link TRTCVideoStreamTypeBig})画面和一路辅路({@link TRTCVideoStreamTypeSub})画面。
 * 2. 默认情况下,屏幕分享使用辅路画面。如果使用主路做屏幕分享,您需要提前停止摄像头采集({@link stopLocalPreview})以避免相互冲突。
 * 3. 同一个房间中同时只能有一个用户使用辅路做屏幕分享,也就是说,同一个房间中同时只允许一个用户开启辅路。
 * 4. 当房间中已经有其他用户在使用辅路分享屏幕时,此时调用该接口会收到来自 {@link TRTCCloudDelegate} 的 onError(ERR_SERVER_CENTER_ANOTHER_USER_PUSH_SUB_VIDEO) 回调。
liumingming authored
909
 */
910
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
911 912 913 914
- (void)startScreenCapture:(NSView *)view streamType:(TRTCVideoStreamType)streamType encParam:(TRTCVideoEncParam *)encParam;
#endif

/**
915
 * 9.2 停止屏幕分享
liumingming authored
916 917 918 919
 */
- (int)stopScreenCapture API_AVAILABLE(ios(11.0));

/**
920
 * 9.3 暂停屏幕分享
liumingming authored
921 922 923 924
 */
- (int)pauseScreenCapture API_AVAILABLE(ios(11.0));

/**
925
 * 9.4 恢复屏幕分享
liumingming authored
926 927 928 929
 */
- (int)resumeScreenCapture API_AVAILABLE(ios(11.0));

/**
930
 * 9.5 枚举可分享的屏幕和窗口(该接口仅支持 Mac OS 系统)
liumingming authored
931
 *
932 933 934
 * 当您在对接桌面端系统的屏幕分享功能时,一般都需要展示一个选择分享目标的界面,这样用户能够使用这个界面选择是分享整个屏幕还是某个窗口。
 * 通过本接口,您就可以查询到当前系统中可用于分享的窗口的 ID、名称以及缩略图。我们在 Demo 中提供了一份默认的界面实现供您参考。
 * @note 返回的列表中包含屏幕和应用窗口,屏幕是列表中的第一个元素。如果用户有多个显示器,那么每个显示器都是一个分享目标。
liumingming authored
935 936 937 938
 * @param thumbnailSize 指定要获取的窗口缩略图大小,缩略图可用于绘制在窗口选择界面上
 * @param iconSize 指定要获取的窗口图标大小
 * @return 窗口列表包括屏幕
 */
939 940 941
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (NSArray<TRTCScreenCaptureSourceInfo *> *)getScreenCaptureSourcesWithThumbnailSize:(CGSize)thumbnailSize iconSize:(CGSize)iconSize;
#endif
liumingming authored
942 943

/**
944
 * 9.6 选取要分享的屏幕或窗口(该接口仅支持 Mac OS 系统)
liumingming authored
945
 *
946 947
 * 当您通过 getScreenCaptureSources 获取到可以分享的屏幕和窗口之后,您可以调用该接口选定期望分享的目标屏幕或目标窗口。
 * 在屏幕分享的过程中,您也可以随时调用该接口以切换分享目标。
liumingming authored
948
 * @param screenSource     指定分享源
949
 * @param rect             指定捕获的区域(设定该参数为 CGRectZero:当分享目标是某个窗口时则分享整个窗口,当分享目标是桌面时则分享整个桌面)
liumingming authored
950 951 952
 * @param capturesCursor   是否捕获鼠标光标
 * @param highlight        是否高亮正在分享的窗口
 */
953 954
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)selectScreenCaptureTarget:(TRTCScreenCaptureSourceInfo *)screenSource rect:(CGRect)rect capturesCursor:(BOOL)capturesCursor highlight:(BOOL)highlight;
liumingming authored
955 956 957
#endif

/**
wangguolei authored
958
 * 9.7 设置屏幕分享(即辅路)的视频编码参数(桌面系统和移动系统均已支持)
959 960 961 962 963
 *
 * 该接口可以设定远端用户所看到的屏幕分享(即辅路)的画面质量,同时也能决定云端录制出的视频文件中屏幕分享的画面质量。
 * 请注意如下两个接口的差异:
 * - {@link setVideoEncoderParam} 用于设置主路画面({@link TRTCVideoStreamTypeBig},一般用于摄像头)的视频编码参数。
 * - {@link setSubStreamEncoderParam} 用于设置辅路画面({@link TRTCVideoStreamTypeSub},一般用于屏幕分享)的视频编码参数。
liumingming authored
964
 *
965 966
 * @param param 辅流编码参数,详情请参考 {@link TRTCVideoEncParam}。
 * @note 即使您使用主路传输屏幕分享(在调用 startScreenCapture 时设置 type=TRTCVideoStreamTypeBig),依然要使用 {@link setSubStreamEncoderParam} 设定屏幕分享的编码参数,而不要使用 {@link setVideoEncoderParam} 。
liumingming authored
967 968 969 970
 */
- (void)setSubStreamEncoderParam:(TRTCVideoEncParam *)param;

/**
971
 * 9.8 设置屏幕分享时的混音音量大小(该接口仅支持桌面系统)
liumingming authored
972
 *
973 974
 * 这个数值越高,屏幕分享音量的占比就越高,麦克风音量占比就越小,所以不推荐设置得太大,否则麦克风的声音就被压制了。
 * @param volume 设置的混音音量大小,范围0 - 100。
liumingming authored
975
 */
976
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
977
- (void)setSubStreamMixVolume:(NSInteger)volume;
978
#endif
liumingming authored
979 980

/**
981
 * 9.9 将指定窗口加入屏幕分享的排除列表中(该接口仅支持桌面系统)
liumingming authored
982
 *
983
 * 加入排除列表中的窗口不会被分享出去,常见的用法是将某个应用的窗口加入到排除列表中以避免隐私问题。
liumingming authored
984
 * 支持启动屏幕分享前设置过滤窗口,也支持屏幕分享过程中动态添加过滤窗口。
985 986 987 988 989
 * @param windowID 不希望分享出去的窗口
 * @note
 *  1. 该接口只有在 {@link TRTCScreenCaptureSourceInfo} 中的 type 指定为 {@link TRTCScreenCaptureSourceTypeScreen} 时生效,即只有在分享整个屏幕内容时,排除指定窗口的功能才生效。
 *  2. 使用该接口添加到排除列表中的窗口会在退出房间后被 SDK 自动清除。
 *  3. Mac 平台下请传入窗口 ID(即 CGWindowID),您可以通过 {@link TRTCScreenCaptureSourceInfo} 中的 sourceId 成员获得。
liumingming authored
990
 */
991
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
992
- (void)addExcludedShareWindow:(NSInteger)windowID;
993
#endif
liumingming authored
994 995

/**
996
 * 9.10 将指定窗口从屏幕分享的排除列表中移除(该接口仅支持桌面系统)
liumingming authored
997
 *
998
 * @param windowID
liumingming authored
999
 */
1000
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
1001
- (void)removeExcludedShareWindow:(NSInteger)windowID;
1002
#endif
liumingming authored
1003 1004

/**
1005
 * 9.11 将所有窗口从屏幕分享的排除列表中移除(该接口仅支持桌面系统)
liumingming authored
1006
 */
1007
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
1008
- (void)removeAllExcludedShareWindows;
1009
#endif
liumingming authored
1010 1011

/**
1012
 * 9.12 将指定窗口加入屏幕分享的包含列表中(该接口仅支持桌面系统)
liumingming authored
1013
 *
1014 1015 1016 1017
 * 该接口只有在 {@link TRTCScreenCaptureSourceInfo} 中的 type 指定为 {@link TRTCScreenCaptureSourceTypeWindow} 时生效。即只有在分享窗口内容时,额外包含指定窗口的功能才生效。
 * 您在 {@link startScreenCapture} 之前和之后调用均可。
 * @param windowID 希望被分享出去的窗口(Windows 平台下为窗口句柄: HWND)
 * @note 通过该方法添加到包含列表中的窗口,会在退出房间后被 SDK 自动清除。
liumingming authored
1018
 */
1019
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
1020
- (void)addIncludedShareWindow:(NSInteger)windowID;
1021
#endif
liumingming authored
1022 1023

/**
1024
 * 9.13 将指定窗口从屏幕分享的包含列表中移除(该接口仅支持桌面系统)
liumingming authored
1025
 *
1026 1027 1028
 * 该接口只有在 {@link TRTCScreenCaptureSourceInfo} 中的 type 指定为 {@link TRTCScreenCaptureSourceTypeWindow} 时生效。
 * 即只有在分享窗口内容时,额外包含指定窗口的功能才生效。
 * @param windowID 希望被分享出去的窗口(Mac 平台: 窗口 ID;Windows 平台: HWND)
liumingming authored
1029
 */
1030
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
1031
- (void)removeIncludedShareWindow:(NSInteger)windowID;
1032
#endif
liumingming authored
1033 1034

/**
1035 1036 1037 1038
 * 9.14 将全部窗口从屏幕分享的包含列表中移除(该接口仅支持桌面系统)
 *
 * 该接口只有在 {@link TRTCScreenCaptureSourceInfo} 中的 type 指定为 {@link TRTCScreenCaptureSourceTypeWindow} 时生效。
 * 即只有在分享窗口内容时,额外包含指定窗口的功能才生效。
liumingming authored
1039
 */
1040
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
1041 1042 1043
- (void)removeAllIncludedShareWindows;
#endif
1044
/// @}
liumingming authored
1045 1046
/////////////////////////////////////////////////////////////////////////////////
//
1047
//                    自定义采集和自定义渲染
liumingming authored
1048 1049
//
/////////////////////////////////////////////////////////////////////////////////
1050
/// @name  自定义采集和自定义渲染
liumingming authored
1051
/// @{
1052
liumingming authored
1053
/**
1054
 * 10.1 启用/关闭视频自定义采集模式
liumingming authored
1055
 *
1056 1057 1058
 * 开启该模式后,SDK 不在运行原有的视频采集流程,即不再继续从摄像头采集数据和美颜,而是只保留视频编码和发送能力。
 * 您需要通过 {@link sendCustomVideoData} 不断地向 SDK 塞入自己采集的视频画面。
 * @param streamType 用于指定视频流类型,{@link TRTCVideoStreamTypeBig}:高清大画面;{@link TRTCVideoStreamTypeSub}:辅路画面。
wangguolei authored
1059
 * @param enable 是否启用,默认值:NO。
liumingming authored
1060 1061 1062 1063
 */
- (void)enableCustomVideoCapture:(TRTCVideoStreamType)streamType enable:(BOOL)enable;

/**
1064
 * 10.2 向 SDK 投送自己采集的视频帧
liumingming authored
1065
 *
1066 1067 1068 1069 1070
 * 使用此接口可以向 SDK 投送自己采集的视频帧,SDK 会将视频帧进行编码并通过自身的网络模块传输出去。
 * 参数 {@link TRTCVideoFrame} 推荐下列填写方式(其他字段不需要填写):
 * - pixelFormat:推荐选择 {@link TRTCVideoPixelFormat_NV12}。
 * - bufferType:推荐选择 {@link TRTCVideoBufferType_PixelBuffer}。
 * - pixelBuffer:iOS/Mac OS 平台上常用的视频数据格式。
liumingming authored
1071
 * - data:视频裸数据格式,bufferType 为 NSData 时使用。
1072
 * - timestamp:时间戳,单位为毫秒(ms),请使用视频帧在采集时被记录下来的时间戳(可以在采集到一帧视频帧之后,通过调用 {@link generateCustomPTS} 获取时间戳)。
liumingming authored
1073 1074 1075 1076
 * - width:视频图像长度,bufferType 为 NSData 时填写。
 * - height:视频图像宽度,bufferType 为 NSData 时填写。
 *
 * 参考文档:[自定义采集和渲染](https://cloud.tencent.com/document/product/647/34066)。
1077
 * @param streamType 用于指定视频流类型,{@link TRTCVideoStreamTypeBig}:高清大画面;{@link TRTCVideoStreamTypeSub}:辅路画面。
liumingming authored
1078
 * @param frame 视频数据,支持 PixelBuffer NV12,BGRA 以及 I420 格式数据。
1079 1080 1081 1082
 * @note
 * 1. 推荐您在采集到的一帧视频帧后,即调用 {@link generateCustomPTS} 接口获取该帧的 timestamp 数值,这样可以获得最佳的音画同步效果。
 * 2. SDK 最终编码出的视频帧率并不是由您调用本接口的频率决定的,而是由您在 {@link setVideoEncoderParam} 中所设置的 FPS 决定的。
 * 3. 请尽量保持本接口的调用间隔是均匀的,否则会导致编码器输出帧率不稳或者音画不同步等问题。
liumingming authored
1083 1084 1085 1086
 */
- (void)sendCustomVideoData:(TRTCVideoStreamType)streamType frame:(TRTCVideoFrame *)frame;

/**
1087
 * 10.3 启用音频自定义采集模式
liumingming authored
1088
 *
1089 1090
 * 开启该模式后,SDK 不在运行原有的音频采集流程,即不再继续从麦克风采集音频数据,而是只保留音频编码和发送能力。
 * 您需要通过 {@link sendCustomAudioData} 不断地向 SDK 塞入自己采集的音频数据。
wangguolei authored
1091
 * @param enable 是否启用,默认值:NO。
1092
 * @note 由于回声抵消(AEC)需要严格的控制声音采集和播放的时间,所以开启自定义音频采集后,AEC 能力可能会失效。
liumingming authored
1093
 */
1094
- (void)enableCustomAudioCapture:(BOOL)enable;
liumingming authored
1095 1096

/**
1097
 * 10.4 向 SDK 投送自己采集的音频数据
liumingming authored
1098
 *
1099 1100 1101 1102 1103 1104
 * 参数 {@link TRTCAudioFrame} 推荐下列填写方式(其他字段不需要填写):
 * - audioFormat:音频数据格式,仅支持 TRTCAudioFrameFormatPCM。
 * - data:音频帧 buffer。音频帧数据只支持 PCM 格式,支持[5ms ~ 100ms]帧长,推荐使用 20ms 帧长,长度计算方法:【48000采样率、单声道的帧长度:48000 × 0.02s × 1 × 16bit = 15360bit = 1920字节】。
 * - sampleRate:采样率,支持:16000、24000、32000、44100、48000。
 * - channel:声道数(如果是立体声,数据是交叉的),单声道:1; 双声道:2。
 * - timestamp:时间戳,单位为毫秒(ms),请使用音频帧在采集时被记录下来的时间戳(可以在采集到一帧音频帧之后,通过调用 {@link generateCustomPTS} 获取时间戳)。
liumingming authored
1105
 *
1106 1107 1108
 * 参考文档:[自定义采集和渲染](https://cloud.tencent.com/document/product/647/34066)。
 * @param frame 音频数据
 * @note 请您精准地按每帧时长的间隔调用本接口,数据投送间隔不均匀时极易触发声音卡顿。
liumingming authored
1109
 */
1110 1111 1112 1113 1114 1115
- (void)sendCustomAudioData:(TRTCAudioFrame *)frame;

/**
 * 10.5 启用/关闭自定义音轨
 *
 * 开启后,您可以通过本接口向 SDK 混入一条自定义的音轨。通过两个布尔型参数,您可以控制该音轨是否要在远端和本地播放。
wangguolei authored
1116 1117 1118
 * @param enablePublish 控制混入的音轨是否要在远端播放,默认值:NO。
 * @param enablePlayout 控制混入的音轨是否要在本地播放,默认值:NO。
 * @note 如果您指定参数 enablePublish 和 enablePlayout 均为 NO,代表完全关闭您的自定义音轨。
1119 1120
 */
- (void)enableMixExternalAudioFrame:(BOOL)enablePublish playout:(BOOL)enablePlayout;
liumingming authored
1121 1122

/**
1123
 * 10.6 向 SDK 混入自定义音轨
liumingming authored
1124
 *
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134
 * 调用该接口之前,您需要先通过 {@link enableMixExternalAudioFrame} 开启自定义音轨,之后就可以通过本接口将自己的音轨以 PCM 格式混入到 SDK 中。
 * 理想情况下,我们期望您的代码能够以非常均匀的速度向 SDK 提供音轨数据。但我们也非常清楚,完美的调用间隔是一个巨大的挑战。
 * 所以 SDK 内部会开启一个音轨数据的缓冲区,该缓冲区的作用类似一个“蓄水池”,它能够暂存您传入的音轨数据,平抑由于接口调用间隔的抖动问题。
 * 本接口的返回值代表这个音轨缓冲区的大小,单位是毫秒(ms),比如:如果该接口返回 50,则代表当前的音轨缓冲区有 50ms 的音轨数据。因此只要您在 50ms 内再次调用本接口,SDK 就能保证您混入的音轨数据是连续的。
 * 当您调用该接口后,如果发现返回值 > 100ms,则可以等待一帧音频帧的播放时间之后再次调用;如果返回值 < 100ms,则代表缓冲区比较小,您可以再次混入一些音轨数据以确保音轨缓冲区的大小维持在“安全水位”以上。
 * 参数 {@link TRTCAudioFrame} 推荐下列填写方式(其他字段不需要填写):
 * - data:音频帧 buffer。音频帧数据只支持 PCM 格式,支持[5ms ~ 100ms]帧长,推荐使用 20ms 帧长,长度计算方法:【48000采样率、单声道的帧长度:48000 × 0.02s × 1 × 16bit = 15360bit = 1920字节】。
 * - sampleRate:采样率,支持:16000、24000、32000、44100、48000。
 * - channel:声道数(如果是立体声,数据是交叉的),单声道:1; 双声道:2。
 * - timestamp:时间戳,单位为毫秒(ms),请使用音频帧在采集时被记录下来的时间戳(可以在获得一帧音频帧之后,通过调用 {@link generateCustomPTS} 获得时间戳)。
liumingming authored
1135
 *
1136
 * @param frame 音频数据
liumingming authored
1137
 *
1138 1139 1140
 * @return >= 0 缓冲的长度,单位:ms。< 0 错误(-1 未启用 mixExternalAudioFrame)
 *
 * @note 请您精准地按每帧时长的间隔调用本接口,数据投送间隔不均匀时极易触发声音卡顿。
liumingming authored
1141
 */
1142
- (int)mixExternalAudioFrame:(TRTCAudioFrame *)frame;
liumingming authored
1143 1144

/**
1145
 * 10.7 设置推流时混入外部音频的推流音量和播放音量
liumingming authored
1146
 *
1147 1148 1149 1150 1151 1152 1153
 * @param publishVolume 设置的推流音量大小,范围0 - 100, -1表示不改变
 * @param playoutVolume 设置的播放音量大小,范围0 - 100, -1表示不改变
 */
- (void)setMixExternalAudioVolume:(NSInteger)publishVolume playoutVolume:(NSInteger)playoutVolume;

/**
 * 10.8 生成自定义采集时的时间戳
liumingming authored
1154
 *
1155 1156 1157 1158 1159
 * 本接口仅适用于自定义采集模式,用于解决音视频帧的采集时间(capture time)和投送时间(send time)不一致所导致的音画不同步问题。
 * 当您通过 {@link sendCustomVideoData} 或 {@link sendCustomAudioData} 等接口进行自定义视频或音频采集时,请按照如下操作使用该接口:
 *  1. 首先,在采集到一帧视频或音频帧时,通过调用本接口获得当时的 PTS 时间戳。
 *  2. 之后可以将该视频或音频帧送入您使用的前处理模块(如第三方美颜组件,或第三方音效组件)。
 *  3. 在真正调用 {@link sendCustomVideoData} 或 {@link sendCustomAudioData} 进行投送时,请将该帧在采集时记录的 PTS 时间戳赋值给 {@link TRTCVideoFrame} 或 {@link TRTCAudioFrame} 中的 timestamp 字段。
liumingming authored
1160
 *
1161
 * @return 时间戳(单位:ms)
liumingming authored
1162
 */
1163
+ (uint64_t)generateCustomPTS;
liumingming authored
1164 1165

/**
1166
 * 10.9 设置第三方美颜的视频数据回调
liumingming authored
1167
 *
1168 1169 1170 1171 1172 1173 1174 1175 1176 1177
 * 设置该回调之后,SDK 会把采集到的视频帧通过您设置的 delegate 回调出来,用于第三方美颜组件进行二次处理,之后 SDK 会将处理后的视频帧进行编码和发送。
 * @param delegate 自定义预处理回调,详见 {@link TRTCVideoFrameDelegate}
 * @param pixelFormat 指定回调的像素格式,目前仅支持 {@link TRTCVideoPixelFormat_Texture_2D}
 * @param bufferType 指定回调的数据格式,目前仅支持 {@link TRTCVideoBufferType_Texture}
 * @return 0:成功;<0:错误
 */
- (int)setLocalVideoProcessDelegete:(id<TRTCVideoFrameDelegate>)delegate pixelFormat:(TRTCVideoPixelFormat)pixelFormat bufferType:(TRTCVideoBufferType)bufferType;

/**
 * 10.10 设置本地视频自定义渲染回调
liumingming authored
1178
 *
1179 1180 1181
 * 设置该回调之后,SDK 内部会跳过原来的渲染流程,并把采集到的数据回调出来,您需要自己完成画面渲染。
 * - pixelFormat 指定回调的数据格式,例如 NV12、i420 以及 32BGRA。
 * - bufferType 指定 buffer 的类型,直接使用 PixelBuffer 效率最高;使用 NSData 相当于让 SDK 在内部做了一次内存转换,因此会有额外的性能损耗。
liumingming authored
1182
 * 参考文档:[自定义采集和渲染](https://cloud.tencent.com/document/product/647/34066)。
1183 1184 1185 1186
 * @param delegate    自定义渲染回调
 * @param pixelFormat 指定回调的像素格式
 * @param bufferType  PixelBuffer:可以直接使用 imageWithCVImageBuffer 转成 UIImage;NSData:经过内存整理的视频数据。
 * @return 0:成功;<0:错误
liumingming authored
1187
 */
1188
- (int)setLocalVideoRenderDelegate:(id<TRTCVideoRenderDelegate>)delegate pixelFormat:(TRTCVideoPixelFormat)pixelFormat bufferType:(TRTCVideoBufferType)bufferType;
liumingming authored
1189 1190

/**
1191
 * 10.11 设置远端视频自定义渲染回调
liumingming authored
1192
 *
1193 1194 1195
 * 设置该回调之后,SDK 内部会跳过原来的渲染流程,并把采集到的数据回调出来,您需要自己完成画面渲染。
 * - pixelFormat 指定回调的数据格式,例如 NV12、i420 以及 32BGRA。
 * - bufferType 指定 buffer 的类型,直接使用 PixelBuffer 效率最高;使用 NSData 相当于让 SDK 在内部做了一次内存转换,因此会有额外的性能损耗。
liumingming authored
1196
 *
1197 1198 1199 1200 1201 1202 1203
 * 参考文档:[自定义采集和渲染](https://cloud.tencent.com/document/product/647/34066)。
 * @note 调用此函数之前,需要先调用 startRemoteView(nil) 来获取远端用户的视频流(view 设置为 nil 即可),否则不会有数据回调出来。
 * @param userId 指定远端用户的 ID
 * @param delegate  自定义渲染回调
 * @param pixelFormat 指定回调的像素格式
 * @param bufferType  PixelBuffer:可以直接使用 imageWithCVImageBuffer 转成 UIImage;NSData:经过内存整理的视频数据。
 * @return 0:成功;<0:错误
liumingming authored
1204
 */
1205
- (int)setRemoteVideoRenderDelegate:(NSString *)userId delegate:(id<TRTCVideoRenderDelegate>)delegate pixelFormat:(TRTCVideoPixelFormat)pixelFormat bufferType:(TRTCVideoBufferType)bufferType;
liumingming authored
1206 1207

/**
1208
 * 10.12 设置音频数据自定义回调
liumingming authored
1209
 *
1210 1211 1212 1213 1214
 * 设置该回调之后,SDK 内部会把音频数据(PCM 格式)回调出来,包括:
 * - {@link onCapturedRawAudioFrame}:本地麦克风采集到的原始音频数据回调
 * - {@link onLocalProcessedAudioFrame}:本地采集并经过音频模块前处理后的音频数据回调
 * - {@link onRemoteUserAudioFrame}:混音前的每一路远程用户的音频数据
 * - {@link onMixedPlayAudioFrame}:将各路音频混合之后并最终要由系统播放出的音频数据回调
liumingming authored
1215
 *
1216
 * @note 设置回调为空即代表停止自定义音频回调,反之,设置回调不为空则代表启动自定义音频回调。
liumingming authored
1217
 */
1218
- (void)setAudioFrameDelegate:(id<TRTCAudioFrameDelegate>)delegate;
liumingming authored
1219 1220

/**
1221
 * 10.13 设置本地麦克风采集出的原始音频帧回调格式
liumingming authored
1222
 *
1223
 * 本接口用于设置 {@link onCapturedRawAudioFrame} 回调出来的 AudioFrame 的格式:
liumingming authored
1224 1225 1226 1227
 * - sampleRate:采样率,支持:16000、32000、44100、48000。
 * - channel:声道数(如果是立体声,数据是交叉的),单声道:1; 双声道:2。
 * - samplesPerCall:采样点数,定义回调数据帧长。帧长必须为 10ms 的整数倍。
 *
1228 1229 1230 1231
 * 如果希望用毫秒数计算回调帧长,则将毫秒数转换成采样点数的公式为:采样点数 = 毫秒数 * 采样率 / 1000;
 * 举例:48000 采样率希望回调 20ms 帧长的数据,则采样点数应该填: 960 = 20 * 48000 / 1000;
 * 注意,最终回调的帧长度是以字节为单位,采样点数转换成字节数的计算公式为:字节数 = 采样点数 * channel * 2(位宽)
 * 举例:48000 采样率,双声道,20ms 帧长,采样点数为 960,字节数为 3840 = 960 * 2 * 2
liumingming authored
1232 1233 1234 1235 1236 1237
 * @param format 音频数据回调格式。
 * @return 0:成功;<0:错误
 */
- (int)setCapturedRawAudioFrameDelegateFormat:(TRTCAudioFrameDelegateFormat *)format;

/**
1238
 * 10.14 设置经过前处理后的本地音频帧回调格式
liumingming authored
1239
 *
1240 1241 1242
 * 本接口用于设置 {@link onLocalProcessedAudioFrame} 回调出来的 AudioFrame 的格式:
 * - sampleRate:采样率,支持:16000、32000、44100、48000。
 * - channel:声道数(如果是立体声,数据是交叉的),单声道:1; 双声道:2。
liumingming authored
1243
 * - samplesPerCall:采样点数,定义回调数据帧长。帧长必须为 10ms 的整数倍。
1244 1245 1246 1247 1248
 *
 * 如果希望用毫秒数计算回调帧长,则将毫秒数转换成采样点数的公式为:采样点数 = 毫秒数 * 采样率 / 1000;
 * 举例:48000 采样率希望回调20ms帧长的数据,则采样点数应该填: 960 = 20 * 48000 / 1000;
 * 注意,最终回调的帧长度是以字节为单位,采样点数转换成字节数的计算公式为:字节数 = 采样点数 * channel * 2(位宽)
 * 举例:48000 采样率,双声道,20ms 帧长,采样点数为 960,字节数为 3840 = 960 * 2 * 2
liumingming authored
1249 1250 1251 1252 1253 1254 1255
 *
 * @param format 音频数据回调格式。
 * @return 0:成功;<0:错误
 */
- (int)setLocalProcessedAudioFrameDelegateFormat:(TRTCAudioFrameDelegateFormat *)format;

/**
1256
 * 10.15 设置最终要由系统播放出的音频帧回调格式
liumingming authored
1257
 *
1258
 * 本接口用于设置 {@link onMixedPlayAudioFrame} 回调出来的 AudioFrame 的格式:
liumingming authored
1259 1260 1261 1262
 * - sampleRate:采样率,支持:16000、32000、44100、48000。
 * - channel:声道数(如果是立体声,数据是交叉的),单声道:1; 双声道:2。
 * - samplesPerCall:采样点数,定义回调数据帧长。帧长必须为 10ms 的整数倍。
 *
1263 1264 1265 1266
 * 如果希望用毫秒数计算回调帧长,则将毫秒数转换成采样点数的公式为:采样点数 = 毫秒数 * 采样率 / 1000;
 * 举例:48000 采样率希望回调20ms帧长的数据,则采样点数应该填: 960 = 20 * 48000 / 1000;
 * 注意,最终回调的帧长度是以字节为单位,采样点数转换成字节数的计算公式为:字节数 = 采样点数 * channel * 2(位宽)
 * 举例:48000 采样率,双声道,20ms 帧长,采样点数为 960,字节数为 3840 = 960 * 2 * 2
liumingming authored
1267 1268 1269 1270 1271 1272
 * @param format 音频数据回调格式。
 * @return 0:成功;<0:错误
 */
- (int)setMixedPlayAudioFrameDelegateFormat:(TRTCAudioFrameDelegateFormat *)format;

/**
1273
 * 10.16 开启音频自定义播放
liumingming authored
1274
 *
1275 1276 1277 1278
 * 如果您需要外接一些特定的音频设备,或者希望自己掌控音频的播放逻辑,您可以通过该接口启用音频自定义播放。
 * 启用音频自定义播放后,SDK 将不再调用系统的音频接口播放数据,您需要通过 {@link getCustomAudioRenderingFrame} 获取 SDK 要播放的音频帧并自行播放。
 * @param enable 是否启用音频自定义播放,默认为关闭状态。
 * @note 需要您在进入房间前设置才能生效,暂不支持进入房间后再设置。
liumingming authored
1279
 */
1280
- (void)enableCustomAudioRendering:(BOOL)enable;
liumingming authored
1281 1282

/**
1283
 * 10.17 获取可播放的音频数据
liumingming authored
1284
 *
1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297
 * 调用该接口之前,您需要先通过 {@link enableCustomAudioRendering} 开启音频自定义播放。
 * 参数 {@link TRTCAudioFrame} 推荐下列填写方式(其他字段不需要填写):
 * - sampleRate:采样率,必填,支持 16000、24000、32000、44100、48000。
 * - channel:声道数,必填,单声道请填1,双声道请填2,双声道时数据是交叉的。
 * - data:用于获取音频数据的 buffer。需要您根据一阵音频帧的帧长度分配好 date 的内存大小。
 *         获取的 PCM 数据支持 10ms 或 20ms 两种帧长,推荐使用 20ms 的帧长。
 * 		计算公式为:48000采样率、单声道、且播放时长为 20ms 的一帧音频帧的 buffer 大小为 48000 × 0.02s × 1 × 16bit = 15360bit = 1920字节。
 *
 * @param audioFrame 音频数据帧。
 * @note
 *   1. 参数 audioFrame 中的 sampleRate、channel 需提前设置好,同时分配好所需读取帧长的 data 空间。
 *   2. SDK 内部会根据 sampleRate 和 channel 自动填充 data 数据。
 *   3. 建议由系统的音频播放线程直接驱动该函数的调用,在播放完一帧音频之后,即调用该接口获取下一帧可播放的音频数据。
liumingming authored
1298 1299
 *
 */
1300
- (void)getCustomAudioRenderingFrame:(TRTCAudioFrame *)audioFrame;
liumingming authored
1301
1302
/// @}
liumingming authored
1303 1304
/////////////////////////////////////////////////////////////////////////////////
//
1305
//                    自定义消息发送接口
liumingming authored
1306 1307
//
/////////////////////////////////////////////////////////////////////////////////
1308
/// @name  自定义消息发送接口
liumingming authored
1309 1310 1311
/// @{

/**
1312
 * 11.1 使用 UDP 通道发送自定义消息给房间内所有用户
liumingming authored
1313
 *
1314 1315 1316 1317 1318 1319 1320
 * 该接口可以让您借助 TRTC 的 UDP 通道,向当前房间里的其他用户广播自定义数据,已达到传输信令的目的。
 * TRTC 中的 UDP 通道原本设计用来传输音视频数据的,该接口的原理是将您要发送的信令伪装成音视频数据包,与原本要发送的音视频数据一并发送出去。
 * 房间中的其他用户可以通过 {@link TRTCCloudDelegate} 中的 onRecvCustomCmdMsg 回调接收消息。
 * @param cmdID 消息 ID,取值范围为1 - 10。
 * @param data 待发送的消息,单个消息的最大长度被限制为 1KB。
 * @param reliable 是否可靠发送,可靠发送可以获得更高的发送成功率,但可靠发送比不可靠发送会带来更大的接收延迟。
 * @param ordered 是否要求有序,即是否要求接收端的数据包顺序和发送端的数据包顺序一致(这会带来一定的接收延时)。
wangguolei authored
1321
 * @return YES:消息已经发出;NO:消息发送失败。
1322 1323 1324 1325
 * @note
 * 1. 发送消息到房间内所有用户(暂时不支持 Web/小程序端),每秒最多能发送30条消息。
 * 2. 每个包最大为 1KB,超过则很有可能会被中间路由器或者服务器丢弃。
 * 3. 每个客户端每秒最多能发送总计 8KB 数据。
wangguolei authored
1326
 * 4. 请将 reliable 和 ordered 同时设置为 YES 或同时设置为 NO,暂不支持交叉设置。
1327
 * 5. 强烈建议您将不同类型的消息设定为不同的 cmdID,这样可以在要求有序的情况下减小消息时延。
liumingming authored
1328 1329 1330 1331
 */
- (BOOL)sendCustomCmdMsg:(NSInteger)cmdID data:(NSData *)data reliable:(BOOL)reliable ordered:(BOOL)ordered;

/**
1332
 * 11.2 使用 SEI 通道发送自定义消息给房间内所有用户
liumingming authored
1333
 *
1334 1335 1336 1337 1338 1339
 * 该接口可以让您借助 TRTC 的 SEI 通道,向当前房间里的其他用户广播自定义数据,已达到传输信令的目的。
 * 视频帧的头部有一个叫做 SEI 的头部数据块,该接口的原理就是利用这个被称为 SEI 的头部数据块,将您要发送的自定义信令嵌入其中,使其同视频帧一并发送出去。
 * 因此,与 {@link sendCustomCmdMsg} 相比,SEI 通道传输的信令具有更好的兼容性:信令可以伴随着视频帧一直传输到直播 CDN 上。
 * 不过,由于视频帧头部的数据块不能太大,建议您使用该接口时,尽量将信令控制在几个字节的大小。
 * 最常见的用法是把自定义的时间戳(timestamp)用本接口嵌入视频帧中,实现消息和画面的完美对齐(比如:教育场景下的课件和视频信号的对齐)。
 * 房间中的其他用户可以通过 {@link TRTCCloudDelegate} 中的 onRecvSEIMsg 回调接收消息。
liumingming authored
1340 1341 1342 1343
 * @param data 待发送的数据,最大支持 1KB(1000字节)的数据大小
 * @param repeatCount 发送数据次数
 * @return YES:消息已通过限制,等待后续视频帧发送;NO:消息被限制发送
 * @note 本接口有以下限制:
1344 1345 1346 1347 1348 1349
 * 1. 数据在接口调用完后不会被即时发送出去,而是从下一帧视频帧开始带在视频帧中发送。
 * 2. 发送消息到房间内所有用户,每秒最多能发送 30 条消息(与 sendCustomCmdMsg 共享限制)。
 * 3. 每个包最大为 1KB,若发送大量数据,会导致视频码率增大,可能导致视频画质下降甚至卡顿(与 sendCustomCmdMsg 共享限制)。
 * 4. 每个客户端每秒最多能发送总计8KB数据(与 sendCustomCmdMsg 共享限制)。
 * 5. 若指定多次发送(repeatCount > 1),则数据会被带在后续的连续 repeatCount 个视频帧中发送出去,同样会导致视频码率增大。
 * 6. 如果 repeatCount > 1,多次发送,接收消息 onRecvSEIMsg 回调也可能会收到多次相同的消息,需要去重。
liumingming authored
1350
 */
1351
- (BOOL)sendSEIMsg:(NSData *)data repeatCount:(int)repeatCount;
liumingming authored
1352 1353 1354 1355

/// @}
/////////////////////////////////////////////////////////////////////////////////
//
1356
//                    网络测试接口
liumingming authored
1357 1358
//
/////////////////////////////////////////////////////////////////////////////////
1359
/// @name  网络测试接口
liumingming authored
1360 1361 1362
/// @{

/**
wangguolei authored
1363
 * 12.1 开始进行网速测试(进入房间前使用)
liumingming authored
1364
 *
wangguolei authored
1365 1366
 * @param params 测速选项
 * @return 接口调用结果,< 0:失败
1367
 * @note
wangguolei authored
1368 1369 1370
 * 1. 带宽测试本身会消耗一定的流量,所以也会产生少量额外的流量费用。
 * 2. 请在进入房间前进行网速测试,在房间中网速测试会影响正常的音视频传输效果,而且由于干扰过多,网速测试结果也不准确。
 * 3. 同一时间只允许一项网速测试任务运行。
liumingming authored
1371
 */
wangguolei authored
1372
- (int)startSpeedTest:(TRTCSpeedTestParams *)params;
liumingming authored
1373 1374

/**
1375
 * 12.2 停止网络测速
liumingming authored
1376 1377 1378 1379 1380 1381
 */
- (void)stopSpeedTest;

/// @}
/////////////////////////////////////////////////////////////////////////////////
//
1382
//                    调试相关接口
liumingming authored
1383 1384
//
/////////////////////////////////////////////////////////////////////////////////
1385
/// @name  调试相关接口
liumingming authored
1386 1387 1388
/// @{

/**
1389
 * 13.1 获取 SDK 版本信息
liumingming authored
1390 1391 1392 1393
 */
+ (NSString *)getSDKVersion;

/**
1394
 * 13.2 设置 Log 输出级别
liumingming authored
1395
 *
1396
 * @param level 参见 {@link TRTCLogLevel},默认值:{@link TRTCLogLevelNone}
liumingming authored
1397 1398 1399 1400
 */
+ (void)setLogLevel:(TRTCLogLevel)level;

/**
1401
 * 13.3 启用/禁用控制台日志打印
liumingming authored
1402
 *
1403
 * @param enabled 指定是否启用,默认:禁止状态
liumingming authored
1404 1405 1406 1407
 */
+ (void)setConsoleEnabled:(BOOL)enabled;

/**
1408
 * 13.4 启用/禁用日志的本地压缩
liumingming authored
1409 1410 1411
 *
 * 开启压缩后,Log 存储体积明显减小,但需要腾讯云提供的 Python 脚本解压后才能阅读。
 * 禁用压缩后,Log 采用明文存储,可以直接用记事本打开阅读,但占用空间较大。
1412
 * @param enabled 指定是否启用,默认为启动状态
liumingming authored
1413 1414 1415 1416
 */
+ (void)setLogCompressEnabled:(BOOL)enabled;

/**
1417 1418 1419 1420 1421 1422
 * 13.5 设置本地日志的保存路径
 *
 * 通过该接口您可以更改 SDK 本地日志的默认存储路径,SDK 默认的本地日志的存储位置:
 * - Windows 平台:在 C:/Users/[系统用户名]/AppData/Roaming/liteav/log,即 %appdata%/liteav/log 下。
 * - iOS 或 Mac 平台:在 sandbox Documents/log 下。
 * - Android 平台:在 /app私有目录/files/log/liteav/ 下。
liumingming authored
1423
 *
1424 1425
 * @note 请务必在所有其他接口之前调用,并且保证您指定的目录是存在的,并且您的应用程序拥有对该目录的读写权限。
 * @param path 存储日志的路径
liumingming authored
1426 1427 1428 1429
 */
+ (void)setLogDirPath:(NSString *)path;

/**
1430
 * 13.6 设置日志回调
liumingming authored
1431 1432 1433 1434
 */
+ (void)setLogDelegate:(id<TRTCLogDelegate>)logDelegate;

/**
1435
 * 13.7 显示仪表盘
liumingming authored
1436
 *
1437 1438
 * “仪表盘”是位于视频渲染控件之上的一个半透明的调试信息浮层,用于展示音视频信息和事件信息,便于对接和调试。
 * @param showType 0:不显示;1:显示精简版(仅显示音视频信息);2:显示完整版(包含音视频信息和事件信息)。
liumingming authored
1439 1440 1441 1442
 */
- (void)showDebugView:(NSInteger)showType;

/**
1443
 * 13.8 设置仪表盘的边距
liumingming authored
1444
 *
1445
 * 用于调整仪表盘在视频渲染控件中的位置,必须在 showDebugView 之前调用才能生效。
liumingming authored
1446
 * @param userId 用户 ID
1447
 * @param margin 仪表盘内边距,注意这里是基于 parentView 的百分比,margin 的取值范围是0 - 1。
liumingming authored
1448 1449 1450 1451
 */
- (void)setDebugViewMargin:(NSString *)userId margin:(TXEdgeInsets)margin;

/**
1452
 * 13.9 调用实验性接口
liumingming authored
1453
 */
1454
- (void)callExperimentalAPI:(NSString *)jsonStr;
liumingming authored
1455 1456 1457 1458

/// @}
/////////////////////////////////////////////////////////////////////////////////
//
1459
//                    弃用接口(建议使用对应的新接口)
liumingming authored
1460 1461
//
/////////////////////////////////////////////////////////////////////////////////
1462
/// @name  弃用接口(建议使用对应的新接口)
liumingming authored
1463 1464 1465 1466 1467
/// @{

/**
 * 设置麦克风的音量大小
 *
1468
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link setAudioCaptureVolume} 替代之。
liumingming authored
1469 1470 1471 1472 1473 1474
 */
- (void)setMicVolumeOnMixing:(NSInteger)volume __attribute__((deprecated("use setAudioCaptureVolume instead")));

/**
 * 设置美颜、美白以及红润效果级别
 *
1475
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1476
 */
1477
- (void)setBeautyStyle:(TRTCBeautyStyle)beautyStyle beautyLevel:(NSInteger)beautyLevel whitenessLevel:(NSInteger)whitenessLevel ruddinessLevel:(NSInteger)ruddinessLevel __attribute__((deprecated("use getBeautyManager instead")));
liumingming authored
1478 1479

/**
1480
 * 设置大眼级别
liumingming authored
1481
 *
1482
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1483
 */
1484
#if TARGET_OS_IPHONE
liumingming authored
1485
- (void)setEyeScaleLevel:(float)eyeScaleLevel __attribute__((deprecated("use getBeautyManager instead")));
1486
#endif
liumingming authored
1487 1488

/**
1489
 * 设置瘦脸级别
liumingming authored
1490
 *
1491
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1492
 */
1493
#if TARGET_OS_IPHONE
liumingming authored
1494
- (void)setFaceScaleLevel:(float)faceScaleLevel __attribute__((deprecated("use getBeautyManager instead")));
1495
#endif
liumingming authored
1496 1497

/**
1498
 * 设置 V 脸级别
liumingming authored
1499
 *
1500
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1501
 */
1502
#if TARGET_OS_IPHONE
liumingming authored
1503
- (void)setFaceVLevel:(float)faceVLevel __attribute__((deprecated("use getBeautyManager instead")));
1504
#endif
liumingming authored
1505 1506

/**
1507
 * 设置下巴拉伸或收缩幅度
liumingming authored
1508
 *
1509
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1510
 */
1511
#if TARGET_OS_IPHONE
liumingming authored
1512
- (void)setChinLevel:(float)chinLevel __attribute__((deprecated("use getBeautyManager instead")));
1513
#endif
liumingming authored
1514 1515

/**
1516
 * 设置短脸级别
liumingming authored
1517
 *
1518
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1519
 */
1520
#if TARGET_OS_IPHONE
liumingming authored
1521
- (void)setFaceShortLevel:(float)faceShortlevel __attribute__((deprecated("use getBeautyManager instead")));
1522
#endif
liumingming authored
1523 1524

/**
1525
 * 设置瘦鼻级别
liumingming authored
1526
 *
1527
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1528
 */
1529
#if TARGET_OS_IPHONE
liumingming authored
1530
- (void)setNoseSlimLevel:(float)noseSlimLevel __attribute__((deprecated("use getBeautyManager instead")));
1531
#endif
liumingming authored
1532 1533

/**
1534
 * 设置动效贴纸
liumingming authored
1535
 *
1536
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1537
 */
1538
#if TARGET_OS_IPHONE
liumingming authored
1539
- (void)selectMotionTmpl:(NSString *)tmplPath __attribute__((deprecated("use getBeautyManager instead")));
1540
#endif
liumingming authored
1541 1542

/**
1543
 * 设置动效静音
liumingming authored
1544
 *
1545
 * @deprecated v6.9 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1546
 */
1547
#if TARGET_OS_IPHONE
liumingming authored
1548
- (void)setMotionMute:(BOOL)motionMute __attribute__((deprecated("use getBeautyManager instead")));
1549
#endif
liumingming authored
1550 1551 1552 1553

/**
 * 启动屏幕分享
 *
1554
 * @deprecated v7.2 版本开始不推荐使用,建议使用 startScreenCapture:streamType:encParam: 替代之。
liumingming authored
1555
 */
1556
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
liumingming authored
1557 1558 1559 1560
- (void)startScreenCapture:(NSView *)view __attribute__((deprecated("use startScreenCapture:streamType:encParam: instead")));
#endif

/**
1561
 * 设置色彩滤镜效果
liumingming authored
1562
 *
1563
 * @deprecated v7.2 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1564 1565 1566 1567
 */
- (void)setFilter:(TXImage *)image __attribute__((deprecated("use getBeautyManager instead")));

/**
1568
 * 设置色彩滤镜浓度
liumingming authored
1569
 *
1570
 * @deprecated v7.2 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1571 1572 1573 1574
 */
- (void)setFilterConcentration:(float)concentration __attribute__((deprecated("use getBeautyManager instead")));

/**
1575
 * 设置绿幕背景视频
liumingming authored
1576
 *
1577
 * @deprecated v7.2 版本开始不推荐使用,建议使用 {@link getBeautyManager} 替代之。
liumingming authored
1578 1579 1580 1581 1582 1583
 */
- (void)setGreenScreenFile:(NSURL *)file __attribute__((deprecated("use getBeautyManager instead")));

/**
 * 启动播放背景音乐
 *
1584
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link getAudioEffectManager} 替代之。
liumingming authored
1585
 */
1586 1587 1588 1589
- (void)playBGM:(NSString *)path
       withBeginNotify:(void (^)(NSInteger errCode))beginNotify
    withProgressNotify:(void (^)(NSInteger progressMS, NSInteger durationMS))progressNotify
     andCompleteNotify:(void (^)(NSInteger errCode))completeNotify __attribute__((deprecated("use getAudioEffectManager instead")));
liumingming authored
1590 1591 1592 1593

/**
 * 停止播放背景音乐
 *
1594
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link getAudioEffectManager} 替代之。
liumingming authored
1595 1596 1597 1598
 */
- (void)stopBGM __attribute__((deprecated("use getAudioEffectManager instead")));

/**
1599
 * 停止播放背景音乐
liumingming authored
1600
 *
1601
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link getAudioEffectManager} 替代之。
liumingming authored
1602 1603 1604 1605
 */
- (void)pauseBGM __attribute__((deprecated("use getAudioEffectManager instead")));

/**
1606
 * 停止播放背景音乐
liumingming authored
1607
 *
1608
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link getAudioEffectManager} 替代之。
liumingming authored
1609 1610 1611 1612
 */
- (void)resumeBGM __attribute__((deprecated("use getAudioEffectManager instead")));

/**
1613
 * 获取背景音乐总时长(单位:毫秒)
liumingming authored
1614
 *
1615
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#getMusicDurationInMS} 替代之。
liumingming authored
1616
 */
1617
- (NSInteger)getBGMDuration:(NSString *)path __attribute__((deprecated("use TXAudioEffectManager#getMusicDurationInMS instead")));
liumingming authored
1618 1619

/**
1620
 * 设置背景音乐的播放进度
liumingming authored
1621
 *
1622
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#seekMusicToPosInMS} 替代之。
liumingming authored
1623
 */
1624
- (int)setBGMPosition:(NSInteger)pos __attribute__((deprecated("use TXAudioEffectManager#seekMusicToPosInMS instead")));
liumingming authored
1625 1626

/**
1627
 * 设置背景音乐的音量大小
liumingming authored
1628
 *
1629
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#setMusicVolume} 替代之。
liumingming authored
1630
 */
1631
- (void)setBGMVolume:(NSInteger)volume __attribute__((deprecated("use TXAudioEffectManager#setMusicVolume instead")));
liumingming authored
1632 1633

/**
1634
 * 设置背景音乐的本地播放音量
liumingming authored
1635
 *
1636
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#setMusicPlayoutVolume} 替代之。
liumingming authored
1637
 */
1638
- (void)setBGMPlayoutVolume:(NSInteger)volume __attribute__((deprecated("use TXAudioEffectManager#setMusicPlayoutVolume instead")));
liumingming authored
1639 1640

/**
1641
 * 设置背景音乐的远端播放音量
liumingming authored
1642
 *
1643
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#setBGMPublishVolume} 替代之。
liumingming authored
1644
 */
1645
- (void)setBGMPublishVolume:(NSInteger)volume __attribute__((deprecated("use TXAudioEffectManager#setBGMPublishVolume instead")));
liumingming authored
1646 1647

/**
1648
 * 设置混响效果
liumingming authored
1649
 *
1650
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#setVoiceReverbType} 替代之。
liumingming authored
1651
 */
1652
- (void)setReverbType:(TRTCReverbType)reverbType __attribute__((deprecated("use TXAudioEffectManager#setVoiceReverbType instead")));
liumingming authored
1653 1654

/**
1655
 * 设置变声类型
liumingming authored
1656
 *
1657
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#setVoiceChangerType} 替代之。
liumingming authored
1658
 */
1659
- (void)setVoiceChangerType:(TRTCVoiceChangerType)voiceChangerType __attribute__((deprecated("use TXAudioEffectManager#setVoiceChangerType instead")));
liumingming authored
1660 1661 1662 1663

/**
 * 播放音效
 *
1664
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#startPlayMusic} 替代之。
liumingming authored
1665
 */
1666
- (void)playAudioEffect:(TRTCAudioEffectParam *)effect __attribute__((deprecated("use TXAudioEffectManager#startPlayMusic instead")));
liumingming authored
1667 1668 1669 1670

/**
 * 设置音效音量
 *
1671
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#setMusicPublishVolume} 和{@link TXAudioEffectManager#setMusicPlayoutVolume} 替代之。
liumingming authored
1672
 */
1673
- (void)setAudioEffectVolume:(int)effectId volume:(int)volume __attribute__((deprecated("use setMusicPublishVolume/setMusicPlayoutVolume instead")));
liumingming authored
1674 1675

/**
1676
 * 停止播放音效
liumingming authored
1677
 *
1678
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#stopPlayMusic} 替代之。
liumingming authored
1679
 */
1680
- (void)stopAudioEffect:(int)effectId __attribute__((deprecated("use TXAudioEffectManager#stopPlayMusic instead")));
liumingming authored
1681 1682 1683 1684

/**
 * 停止所有音效
 *
1685
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#stopPlayMusic} 替代之。
liumingming authored
1686
 */
1687
- (void)stopAllAudioEffects __attribute__((deprecated("use TXAudioEffectManager#stopPlayMusic instead")));
liumingming authored
1688 1689 1690 1691

/**
 * 设置所有音效音量
 *
1692
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#setMusicPublishVolume} 和{@link TXAudioEffectManager#setMusicPlayoutVolume} 替代之。
liumingming authored
1693
 */
1694
- (void)setAllAudioEffectsVolume:(int)volume __attribute__((deprecated("use setMusicPublishVolume/setMusicPlayoutVolume instead")));
liumingming authored
1695 1696 1697 1698

/**
 * 暂停音效
 *
1699
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#pauseAudioEffect} 替代之。
liumingming authored
1700
 */
1701
- (void)pauseAudioEffect:(int)effectId __attribute__((deprecated("use TXAudioEffectManager#pauseAudioEffect instead")));
liumingming authored
1702 1703

/**
1704
 * 暂停音效
liumingming authored
1705
 *
1706
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#resumePlayMusic} 替代之。
liumingming authored
1707
 */
1708
- (void)resumeAudioEffect:(int)effectId __attribute__((deprecated("use TXAudioEffectManager#resumePlayMusic instead")));
liumingming authored
1709 1710

/**
1711
 * 开启(或关闭)耳返
liumingming authored
1712
 *
1713
 * @deprecated v7.3 版本开始不推荐使用,建议使用 {@link TXAudioEffectManager#setVoiceEarMonitor} 替代之。
liumingming authored
1714
 */
1715 1716
#if TARGET_OS_IPHONE
- (void)enableAudioEarMonitoring:(BOOL)enable __attribute__((deprecated("use TXAudioEffectManager#setVoiceEarMonitor instead")));
liumingming authored
1717 1718 1719 1720 1721
#endif

/**
 * 开始显示远端视频画面
 *
1722
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link startRemoteView:streamType:view} 替代之。
liumingming authored
1723 1724 1725 1726 1727 1728
 */
- (void)startRemoteView:(NSString *)userId view:(TXView *)view __attribute__((deprecated("use startRemoteView:streamType:view: instead")));

/**
 * 停止显示远端视频画面,同时不再拉取该远端用户的视频数据流
 *
1729
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link stopRemoteView:streamType:} 替代之。
liumingming authored
1730 1731 1732 1733 1734 1735
 */
- (void)stopRemoteView:(NSString *)userId __attribute__((deprecated("use stopRemoteView:streamType: instead")));

/**
 * 设置远端图像的渲染模式
 *
1736
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link setRemoteRenderParams:streamType:params:} 替代之。
liumingming authored
1737
 */
1738
- (void)setRemoteViewFillMode:(NSString *)userId mode:(TRTCVideoFillMode)mode __attribute__((deprecated("use setRemoteRenderParams:streamType:params: instead")));
liumingming authored
1739 1740 1741 1742

/**
 * 设置远端图像的顺时针旋转角度
 *
1743
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link setRemoteRenderParams:streamType:params:} 替代之。
liumingming authored
1744
 */
1745
- (void)setRemoteViewRotation:(NSString *)userId rotation:(TRTCVideoRotation)rotation __attribute__((deprecated("use setRemoteRenderParams:streamType:params: instead")));
liumingming authored
1746 1747 1748 1749

/**
 * 设置本地图像的渲染模式
 *
1750
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link setLocalRenderParams} 替代之。
liumingming authored
1751
 */
1752
- (void)setLocalViewFillMode:(TRTCVideoFillMode)mode __attribute__((deprecated("use setLocalRenderParams instead")));
liumingming authored
1753 1754 1755 1756

/**
 * 设置本地图像的顺时针旋转角度
 *
1757
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link setLocalRenderParams} 替代之。
liumingming authored
1758
 */
1759
- (void)setLocalViewRotation:(TRTCVideoRotation)rotation __attribute__((deprecated("use setLocalRenderParams instead")));
liumingming authored
1760 1761

/**
1762
 * 设置本地摄像头预览画面的镜像模式
liumingming authored
1763
 *
1764
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link setLocalRenderParams} 替代之。
liumingming authored
1765
 */
1766
#if TARGET_OS_IPHONE
liumingming authored
1767 1768
- (void)setLocalViewMirror:(TRTCLocalVideoMirrorType)mirror __attribute__((deprecated("use setLocalRenderParams: instead")));
#elif TARGET_OS_MAC
1769 1770
- (void)setLocalViewMirror:(BOOL)mirror __attribute__((deprecated("use setLocalRenderParams: instead")));
#endif
liumingming authored
1771 1772

/**
1773
 * 开始显示远端用户的辅路画面
liumingming authored
1774
 *
1775
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link startRemoteView:streamType:view} 替代之。
liumingming authored
1776
 */
1777
- (void)startRemoteSubStreamView:(NSString *)userId view:(TXView *)view __attribute__((deprecated("use startRemoteView:type:view: instead")));
liumingming authored
1778 1779

/**
1780
 * 停止显示远端用户的辅路画面
liumingming authored
1781
 *
1782 1783 1784 1785 1786 1787
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link stopRemoteView:streamType:} 替代之。
 */
- (void)stopRemoteSubStreamView:(NSString *)userId __attribute__((deprecated("use stopRemoteView:streamType: instead")));

/**
 * 设置辅路画面的填充模式
liumingming authored
1788
 *
1789
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link setRemoteRenderParams:streamType:params:} 替代之。
liumingming authored
1790 1791 1792 1793
 */
- (void)setRemoteSubStreamViewFillMode:(NSString *)userId mode:(TRTCVideoFillMode)mode __attribute__((deprecated("use setRemoteRenderParams:streamType:params: instead")));

/**
1794
 * 设置辅路画面的顺时针旋转角度
liumingming authored
1795
 *
1796
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link setRemoteRenderParams:streamType:params:} 替代之。
liumingming authored
1797
 */
1798
- (void)setRemoteSubStreamViewRotation:(NSString *)userId rotation:(TRTCVideoRotation)rotation __attribute__((deprecated("use setRemoteRenderParams:streamType:params: instead")));
liumingming authored
1799 1800

/**
1801
 * 设定优先观看大画面还是小画面
liumingming authored
1802
 *
1803
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link startRemoteView:streamType:view:} 替代之。
liumingming authored
1804
 */
1805
- (void)setPriorRemoteVideoStreamType:(TRTCVideoStreamType)streamType __attribute__((deprecated("use startRemoteView:streamType:view: instead")));
liumingming authored
1806 1807 1808 1809

/**
 * 设置音频质量
 *
1810
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link startLocalAudio:}(quality) 替代之。
liumingming authored
1811 1812 1813 1814
 */
- (void)setAudioQuality:(TRTCAudioQuality)quality __attribute__((deprecated("use startLocalAudio(quality) instead")));

/**
1815
 * 设置音频质量
liumingming authored
1816
 *
1817
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link startLocalAudio:}(quality) 替代之。
liumingming authored
1818 1819 1820 1821 1822 1823
 */
- (void)startLocalAudio __attribute__((deprecated("use startLocalAudio(quality) instead")));

/**
 * 切换摄像头
 *
1824
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 switchCamera 接口替代之。
liumingming authored
1825
 */
1826 1827 1828
#if TARGET_OS_IPHONE
- (void)switchCamera __attribute__((deprecated("use TXDeviceManager#switchCamera instead")));
#endif
liumingming authored
1829 1830 1831 1832

/**
 * 查询当前摄像头是否支持缩放
 *
1833
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 isCameraZoomSupported 接口替代之。
liumingming authored
1834
 */
1835 1836 1837
#if TARGET_OS_IPHONE
- (BOOL)isCameraZoomSupported __attribute__((deprecated("use TXDeviceManager#isCameraZoomSupported instead")));
#endif
liumingming authored
1838 1839

/**
1840
 * 设置摄像头缩放倍数(焦距)
liumingming authored
1841
 *
1842
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setCameraZoomRatio 接口替代之。
liumingming authored
1843
 */
1844 1845 1846
#if TARGET_OS_IPHONE
- (void)setZoom:(CGFloat)distance __attribute__((deprecated("use TXDeviceManager#setCameraZoomRatio instead")));
#endif
liumingming authored
1847 1848

/**
1849
 * 查询是否支持开关闪光灯
liumingming authored
1850
 *
1851
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 isCameraTorchSupported 接口替代之。
liumingming authored
1852
 */
1853 1854 1855
#if TARGET_OS_IPHONE
- (BOOL)isCameraTorchSupported __attribute__((deprecated("use TXDeviceManager#isCameraTorchSupported instead")));
#endif
liumingming authored
1856 1857

/**
1858
 * 开关/关闭闪光灯
liumingming authored
1859
 *
1860
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 enableCameraTorch 接口替代之。
liumingming authored
1861
 */
1862 1863 1864
#if TARGET_OS_IPHONE
- (BOOL)enbaleTorch:(BOOL)enable __attribute__((deprecated("use TXDeviceManager#enableCameraTorch instead")));
#endif
liumingming authored
1865 1866

/**
1867
 * 查询摄像头是否支持设置焦点
liumingming authored
1868
 *
1869
 * @deprecated v8.0 版本开始不推荐使用。
liumingming authored
1870
 */
1871 1872 1873
#if TARGET_OS_IPHONE
- (BOOL)isCameraFocusPositionInPreviewSupported __attribute__((deprecated));
#endif
liumingming authored
1874 1875

/**
1876
 * 设置摄像头焦点坐标位置
liumingming authored
1877
 *
1878
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setCameraFocusPosition 接口替代之。
liumingming authored
1879
 */
1880 1881 1882
#if TARGET_OS_IPHONE
- (void)setFocusPosition:(CGPoint)touchPoint __attribute__((deprecated("use TXDeviceManager#setCameraFocusPosition instead")));
#endif
liumingming authored
1883 1884

/**
1885
 * 查询是否支持自动识别人脸位置
liumingming authored
1886
 *
1887
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 isAutoFocusEnabled 接口替代之。
liumingming authored
1888
 */
1889 1890 1891
#if TARGET_OS_IPHONE
- (BOOL)isCameraAutoFocusFaceModeSupported __attribute__((deprecated("use TXDeviceManager#isAutoFocusEnabled instead")));
#endif
liumingming authored
1892 1893

/**
1894
 * 开启/关闭人脸跟踪对焦
liumingming authored
1895
 *
1896
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 enableCameraAutoFocus 接口替代之。
liumingming authored
1897
 */
1898 1899
#if TARGET_OS_IPHONE
- (void)enableAutoFaceFoucs:(BOOL)enable __attribute__((deprecated("use TXDeviceManager#enableCameraAutoFocus instead")));
liumingming authored
1900 1901 1902
#endif

/**
1903
 * 开始进行摄像头测试
liumingming authored
1904
 *
1905
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 startCameraDeviceTest 接口替代之。
liumingming authored
1906 1907
 */
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
1908 1909
- (void)startCameraDeviceTestInView:(NSView *)view __attribute__((deprecated("use TXDeviceManager#startCameraDeviceTest instead")));
#endif
liumingming authored
1910 1911 1912 1913

/**
 * 开始进行摄像头测试
 *
1914
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 stopCameraDeviceTest 接口替代之。
liumingming authored
1915
 */
1916 1917 1918
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)stopCameraDeviceTest __attribute__((deprecated("use TXDeviceManager#stopCameraDeviceTest instead")));
#endif
liumingming authored
1919 1920 1921 1922

/**
 * 开始进行麦克风测试
 *
1923
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 startMicDeviceTest 接口替代之。
liumingming authored
1924
 */
1925 1926 1927
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)startMicDeviceTest:(NSInteger)interval testEcho:(void (^)(NSInteger volume))testEcho __attribute__((deprecated("use TXDeviceManager#startMicDeviceTest instead")));
#endif
liumingming authored
1928 1929

/**
1930
 * 开始进行麦克风测试
liumingming authored
1931
 *
1932
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 stopMicDeviceTest 接口替代之。
liumingming authored
1933
 */
1934 1935 1936
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)stopMicDeviceTest __attribute__((deprecated("use TXDeviceManager#stopMicDeviceTest instead")));
#endif
liumingming authored
1937 1938

/**
1939
 * 开始进行扬声器测试
liumingming authored
1940
 *
1941
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 startSpeakerDeviceTest 接口替代之。
liumingming authored
1942
 */
1943 1944 1945
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)startSpeakerDeviceTest:(NSString *)audioFilePath onVolumeChanged:(void (^)(NSInteger volume, BOOL isLastFrame))volumeBlock __attribute__((deprecated("use TXDeviceManager#startSpeakerDeviceTest instead")));
#endif
liumingming authored
1946 1947

/**
1948
 * 停止进行扬声器测试
liumingming authored
1949
 *
1950
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 stopSpeakerDeviceTest 接口替代之。
liumingming authored
1951
 */
1952 1953 1954
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)stopSpeakerDeviceTest __attribute__((deprecated("use TXDeviceManager#stopSpeakerDeviceTest instead")));
#endif
liumingming authored
1955 1956 1957 1958

/**
 * 获取麦克风设备列表
 *
1959
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getDevicesList 接口替代之。
liumingming authored
1960
 */
1961 1962 1963
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (NSArray<TRTCMediaDeviceInfo *> *)getMicDevicesList __attribute__((deprecated("use TXDeviceManager#getDevicesList instead")));
#endif
liumingming authored
1964 1965 1966 1967

/**
 * 获取当前的麦克风设备
 *
1968
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getCurrentDevice 接口替代之。
liumingming authored
1969
 */
1970 1971 1972
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (TRTCMediaDeviceInfo *)getCurrentMicDevice __attribute__((deprecated("use TXDeviceManager#getCurrentDevice instead")));
#endif
liumingming authored
1973 1974

/**
1975
 * 选定当前使用的麦克风
liumingming authored
1976
 *
1977
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setCurrentDevice 接口替代之。
liumingming authored
1978
 */
1979 1980 1981
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (int)setCurrentMicDevice:(NSString *)deviceId __attribute__((deprecated("use TXDeviceManager#setCurrentDevice instead")));
#endif
liumingming authored
1982 1983

/**
1984
 * 获取当前麦克风的设备音量
liumingming authored
1985
 *
1986
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getCurrentDeviceVolume 接口替代之。
liumingming authored
1987
 */
1988 1989 1990
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (float)getCurrentMicDeviceVolume __attribute__((deprecated("use TXDeviceManager#getCurrentDeviceVolume instead")));
#endif
liumingming authored
1991 1992

/**
1993
 * 设置当前麦克风的设备音量
liumingming authored
1994
 *
1995
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setCurrentDeviceVolume 接口替代之。
liumingming authored
1996
 */
1997 1998 1999
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)setCurrentMicDeviceVolume:(NSInteger)volume __attribute__((deprecated("use TXDeviceManager#setCurrentDeviceVolume instead")));
#endif
liumingming authored
2000 2001

/**
2002
 * 获取系统当前麦克风设备是否静音
liumingming authored
2003
 *
2004
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getCurrentDeviceMute 接口替代之。
liumingming authored
2005
 */
2006 2007 2008
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (BOOL)getCurrentMicDeviceMute __attribute__((deprecated("use TXDeviceManager#getCurrentDeviceMute instead")));
#endif
liumingming authored
2009 2010

/**
2011
 * 设置系统当前麦克风设备的静音状态
liumingming authored
2012
 *
2013
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setCurrentDeviceMute 接口替代之。
liumingming authored
2014
 */
2015 2016 2017
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)setCurrentMicDeviceMute:(BOOL)mute __attribute__((deprecated("use TXDeviceManager#setCurrentDeviceMute instead")));
#endif
liumingming authored
2018 2019 2020 2021

/**
 * 获取扬声器设备列表
 *
2022
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getDevicesList 接口替代之。
liumingming authored
2023
 */
2024 2025 2026
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (NSArray<TRTCMediaDeviceInfo *> *)getSpeakerDevicesList __attribute__((deprecated("use TXDeviceManager#getDevicesList instead")));
#endif
liumingming authored
2027 2028 2029 2030

/**
 * 获取当前的扬声器设备
 *
2031
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getCurrentDevice 接口替代之。
liumingming authored
2032
 */
2033 2034 2035
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (TRTCMediaDeviceInfo *)getCurrentSpeakerDevice __attribute__((deprecated("use TXDeviceManager#getCurrentDevice instead")));
#endif
liumingming authored
2036 2037 2038 2039

/**
 * 设置要使用的扬声器
 *
2040
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setCurrentDevice 接口替代之。
liumingming authored
2041
 */
2042 2043 2044
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (int)setCurrentSpeakerDevice:(NSString *)deviceId __attribute__((deprecated("use TXDeviceManager#setCurrentDevice instead")));
#endif
liumingming authored
2045 2046

/**
2047
 * 获取当前扬声器的设备音量
liumingming authored
2048
 *
2049
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getCurrentDeviceVolume 接口替代之。
liumingming authored
2050
 */
2051 2052 2053
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (float)getCurrentSpeakerDeviceVolume __attribute__((deprecated("use TXDeviceManager#getCurrentDeviceVolume instead")));
#endif
liumingming authored
2054 2055

/**
2056
 * 设置当前扬声器的设备音量
liumingming authored
2057
 *
2058
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setCurrentDeviceVolume 接口替代之。
liumingming authored
2059
 */
2060 2061 2062
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (int)setCurrentSpeakerDeviceVolume:(NSInteger)volume __attribute__((deprecated("use TXDeviceManager#setCurrentDeviceVolume instead")));
#endif
liumingming authored
2063 2064

/**
2065
 * 获取系统当前扬声器设备是否静音
liumingming authored
2066
 *
2067
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getCurrentDeviceMute 接口替代之。
liumingming authored
2068
 */
2069 2070 2071
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (BOOL)getCurrentSpeakerDeviceMute __attribute__((deprecated("use TXDeviceManager#getCurrentDeviceMute instead")));
#endif
liumingming authored
2072 2073

/**
2074
 * 设置系统当前扬声器设备的静音状态
liumingming authored
2075
 *
2076
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setCurrentDeviceMute 接口替代之。
liumingming authored
2077
 */
2078 2079 2080
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (void)setCurrentSpeakerDeviceMute:(BOOL)mute __attribute__((deprecated("use TXDeviceManager#setCurrentDeviceMute instead")));
#endif
liumingming authored
2081 2082 2083 2084

/**
 * 获取摄像头设备列表
 *
2085
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getDevicesList 接口替代之。
liumingming authored
2086
 */
2087 2088 2089
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (NSArray<TRTCMediaDeviceInfo *> *)getCameraDevicesList __attribute__((deprecated("use TXDeviceManager#getDevicesList instead")));
#endif
liumingming authored
2090 2091 2092 2093

/**
 * 获取当前使用的摄像头
 *
2094
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 getCurrentDevice 接口替代之。
liumingming authored
2095
 */
2096 2097 2098
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (TRTCMediaDeviceInfo *)getCurrentCameraDevice __attribute__((deprecated("use TXDeviceManager#getCurrentDevice instead")));
#endif
liumingming authored
2099 2100

/**
2101
 * 选定当前要使用的摄像头
liumingming authored
2102
 *
2103
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setCurrentDevice 接口替代之。
liumingming authored
2104
 */
2105 2106
#if !TARGET_OS_IPHONE && TARGET_OS_MAC
- (int)setCurrentCameraDevice:(NSString *)deviceId __attribute__((deprecated("use TXDeviceManager#setCurrentDevice instead")));
liumingming authored
2107 2108 2109
#endif

/**
2110 2111 2112 2113 2114 2115 2116 2117
 * 设置系统音量类型
 *
 * @deprecated v8.0 版本开始不推荐使用,建议使用 {@link TXDeviceManager} 中的 setSystemVolumeType  接口替代之。
 */
- (void)setSystemVolumeType:(TRTCSystemVolumeType)type __attribute__((deprecated("use getDeviceManager instead")));

/**
 * 视频截图
liumingming authored
2118
 *
2119
 * @deprecated v8.2 版本开始不推荐使用,建议使用 snapshotVideo:type:sourceType:completionBlock 替代之。
liumingming authored
2120
 */
2121
- (void)snapshotVideo:(NSString *)userId type:(TRTCVideoStreamType)streamType completionBlock:(void (^)(TXImage *image))completionBlock __attribute__((deprecated("use snapshotVideo:type:sourceType:completionBlock instead")));
liumingming authored
2122 2123 2124 2125

/**
 * 启用视频自定义采集模式
 *
2126 2127 2128 2129 2130 2131
 * @deprecated v8.5 版本开始不推荐使用,建议使用 enableCustomVideoCapture(streamType,enable) 接口替代之。
 */
- (void)enableCustomVideoCapture:(BOOL)enable __attribute__((deprecated("use enableCustomVideoCapture:enable instead")));

/**
 * 投送自己采集的视频数据
liumingming authored
2132
 *
2133
 * @deprecated v8.5 版本开始不推荐使用,建议使用 sendCustomVideoData(streamType, TRTCVideoFrame) 接口替代之。
liumingming authored
2134
 */
2135
- (void)sendCustomVideoData:(TRTCVideoFrame *)frame __attribute__((deprecated("use sendCustomVideoData:frame: instead")));
liumingming authored
2136 2137

/**
2138
 * 开始应用内的屏幕分享(iOS)
liumingming authored
2139
 *
2140 2141 2142 2143 2144 2145
 * @deprecated v8.6 版本开始不推荐使用,建议使用 startScreenCaptureInApp:encParam: 接口替代之。
 */
- (void)startScreenCaptureInApp:(TRTCVideoEncParam *)encParams __attribute__((deprecated("use startScreenCaptureInApp:encParam: instead")));

/**
 * 开始全系统的屏幕分享(iOS)
liumingming authored
2146
 *
2147 2148 2149 2150 2151 2152
 * @deprecated v8.6 版本开始不推荐使用,建议使用 startScreenCaptureByReplaykit:encParam:appGroup:接口替代之。
 */
- (void)startScreenCaptureByReplaykit:(TRTCVideoEncParam *)encParams appGroup:(NSString *)appGroup __attribute__((deprecated("use startScreenCaptureByReplaykit:encParam:appGroup: instead")));

/**
 * 暂停/恢复发布本地的视频流
liumingming authored
2153
 *
2154 2155 2156 2157 2158 2159
 * @deprecated v8.9 版本开始不推荐使用,建议使用 muteLocalVideo(streamType, mute) 接口替代之。
 */
- (void)muteLocalVideo:(BOOL)mute __attribute__((deprecated("use muteLocalVideo:streamType:mute: instead")));

/**
 * 暂停 / 恢复订阅远端用户的视频流
liumingming authored
2160
 *
2161
 * @deprecated v8.9 版本开始不推荐使用,建议使用 muteRemoteVideoStream(userId, streamType, mute) 接口替代之。
liumingming authored
2162
 */
2163
- (void)muteRemoteVideoStream:(NSString *)userId mute:(BOOL)mute __attribute__((deprecated("use muteRemoteVideoStream:userid,streamType:mute: instead")));
liumingming authored
2164
wangguolei authored
2165 2166 2167 2168 2169 2170 2171 2172 2173 2174
/**
 *  开始进行网络测速(进入房间前使用)
 *
 * @deprecated v9.2 版本开始不推荐使用,建议使用 startSpeedTest(params) 接口替代之。
 */
- (void)startSpeedTest:(uint32_t)sdkAppId
                userId:(NSString *)userId
               userSig:(NSString *)userSig
            completion:(void (^)(TRTCSpeedTestResult *result, NSInteger completedCount, NSInteger totalCount))completion __attribute__((deprecated("use startSpeedTest: instead")));
liumingming authored
2175 2176
/// @}
@end
2177
/// @}