@interface ByteRTCRoom : NSObject
objectivec| 类型 | 名称 |
|---|---|
| id | delegate |
@property(nonatomic, weak) id<ByteRTCRoomDelegate> _Nullable delegate;
objectivec- (void)destroy;
objectivec退出并销毁调用 createRTCRoom: 所创建的房间实例。
- (NSString *_Nonnull)getRoomId;
objectivecAvailable since 3.53
获取房间 ID。
返回值
房间 ID。
- (int)setRTCRoomDelegate:(id<ByteRTCRoomDelegate> _Nullable)roomDelegate;
objectivec通过设置 ByteRTCRoom 对象的事件句柄,监听此对象对应的回调事件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| roomDelegate | id | 参见 ByteRTCRoomDelegate。 |
返回值
- (int)joinRoom:(NSString *_Nullable)token userInfo:(ByteRTCUserInfo *_Nonnull)userInfo roomConfig:(ByteRTCRoomConfig *_Nonnull)roomConfig;
objectivec加入房间。
调用 createRTCRoom: 创建房间后,调用此方法加入房间,同房间内其他用户进行音视频通话。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| token | NSString* | 动态密钥,用于对进房用户进行鉴权验证。 进入房间需要携带 Token。测试时可使用控制台生成临时 Token,正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token。Token 有效期及生成方式参看使用 Token 完成鉴权。 使用不同 AppID 的 App 是不能互通的。 请务必保证生成 Token 使用的 AppID 和创建引擎时使用的 AppID 相同,否则会导致加入房间失败。 |
| userInfo | ByteRTCUserInfo* | 用户信息。参看 ByteRTCUserInfo。 |
| roomConfig | ByteRTCRoomConfig* | 房间参数配置,设置房间模式以及是否自动发布或订阅流。具体配置模式参看 ByteRTCRoomConfig。 |
返回值
方法调用结果。
注意
- (int)setUserVisibility:(BOOL)enable;
objectivec设置用户可见性。未调用该接口前,本地用户默认对他人可见。
默认情况下,一个 RTC 房间最多同时容纳 50 名可见用户,最多 30 人可同时上麦。更多信息参看用户和媒体流上限。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | BOOL | 设置用户是否对房间内其他用户可见: • YES: 可见,用户可以在房间内发布音视频流,房间中的其他用户将收到用户的行为通知,例如进房、开启视频采集和退房。 • NO: 不可见,用户不可以在房间内发布音视频流,房间中的其他用户不会收到用户的行为通知,例如进房、开启视频采集和退房。 |
返回值
注意
false,此时尝试发布流会收到 ByteRTCWarningCodeSubscribeStreamForbiden 警告。- (int)setMultiDeviceAVSync:(NSString* _Nullable) audioUserId;
objectivec设置发流端音画同步。
当同一用户同时使用两个通话设备分别采集发送音频和视频时,有可能会因两个设备所处的网络环境不一致而导致发布的流不同步,此时你可以在视频发送端调用该接口,SDK 会根据音频流的时间戳自动校准视频流,以保证接收端听到音频和看到视频在时间上的同步性。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioUserId | NSString* | 音频发送端的用户 ID,将该参数设为空则可解除当前音视频的同步关系。 |
返回值
注意
audioUserId 即可;如需更换同步视频源,需先解除当前的同步关系,后在新视频源端开启同步。- (int)leaveRoom;
objectivec离开房间。
用户调用此方法离开房间,结束通话过程,释放所有通话相关的资源。
返回值
注意
- (int)updateToken:(NSString *_Nullable)token;
objectivec更新 Token。
收到 onTokenWillExpire:,onPublishPrivilegeTokenWillExpire:,或 onSubscribePrivilegeTokenWillExpire: 时,你必须重新获取 Token,并调用此方法更新 Token,以保证通话的正常进行。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| token | NSString* | 重新获取的有效 Token。 如果 Token 无效,你会收到 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:,错误码是 -1010。 |
返回值
注意
请勿同时调用 updateToken: 和 joinRoom:userInfo:roomConfig: 重新加入房间。
- (int) setRemoteVideoConfig:(NSString * _Nonnull) userId remoteVideoConfig:(ByteRTCRemoteVideoConfig *_Nonnull) remoteVideoConfig;
objectivec设置期望订阅的远端视频流的参数。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userId | NSString* | 期望配置订阅参数的远端视频流发布用户的 ID。 |
| remoteVideoConfig | ByteRTCRemoteVideoConfig* | 期望配置的远端视频流参数,参看 ByteRTCRemoteVideoConfig。 |
返回值
方法调用结果:
注意
roomConfig 中的 remoteVideoConfig 进行设置。- (int)publishStream:(ByteRTCMediaStreamType)type;
objectivec在当前所在房间内发布本地通过摄像头/麦克风采集的媒体流
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCMediaStreamType | 媒体流类型,用于指定发布音频/视频,参看 ByteRTCMediaStreamType |
返回值
注意
- (int)unpublishStream:(ByteRTCMediaStreamType)type;
objectivec停止将本地摄像头/麦克风采集的媒体流发布到当前所在房间中
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCMediaStreamType | 媒体流类型,用于指定停止发布音频/视频,参看 ByteRTCMediaStreamType |
返回值
注意
- (int)publishScreen:(ByteRTCMediaStreamType)type;
objectivec在当前所在房间内发布本地屏幕共享音视频流
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCMediaStreamType | 媒体流类型,用于指定发布屏幕音频/视频,参看 ByteRTCMediaStreamType。 |
返回值
注意
- (int)unpublishScreen:(ByteRTCMediaStreamType)type;
objectivec停止将本地屏幕共享音视频流发布到当前所在房间中
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCMediaStreamType | 媒体流类型,用于指定停止发布屏幕音频/视频,参看 ByteRTCMediaStreamType |
返回值
注意
- (int)subscribeUserStream:(NSString *_Nonnull)userId streamType:(ByteRTCStreamIndex)streamType mediaType:(ByteRTCSubscribeMediaType)mediaType videoConfig:(ByteRTCSubscribeVideoConfig *_Nonnull)videoConfig __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.36 and will be deleted in 3.51, use subscribeStream:mediaStreamType:, unsubscribeStream:mediaStreamType:, subscribeScreen:mediaStreamType: and unsubscribeScreen:mediaStreamType: instead.
订阅房间内指定的远端音视频流。
无论是自动订阅还是手动订阅模式,你都可以调用此方法按需订阅房间中的音视频流。
该方法也可用于更新已经订阅的流的属性、媒体类型等配置。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userId | NSString* | 指定订阅的远端发布音视频流的用户 ID 。 |
| streamType | ByteRTCStreamIndex | 流属性,用于指定订阅主流/屏幕流,参看 ByteRTCStreamIndex 。 |
| mediaType | ByteRTCSubscribeMediaType | 媒体类型,用于指定订阅音/视频,参看 ByteRTCSubscribeMediaType。 |
| videoConfig | ByteRTCSubscribeVideoConfig* | 视频订阅配置,参看 ByteRTCSubscribeVideoConfig。 |
注意
- (int)subscribeStream:(NSString *_Nonnull)userId mediaStreamType:(ByteRTCMediaStreamType)mediaStreamType;
objectivec订阅房间内指定的通过摄像头/麦克风采集的媒体流,或更新对指定远端用户的订阅选项
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userId | NSString* | 指定订阅的远端发布音视频流的用户 ID。 |
| mediaStreamType | ByteRTCMediaStreamType | 媒体流类型,用于指定订阅音频/视频。参看 ByteRTCMediaStreamType。 |
返回值
方法调用结果:
注意
- (int)subscribeAllStreamsWithMediaStreamType:(ByteRTCMediaStreamType)mediaStreamType;
objectivec订阅房间内所有通过摄像头/麦克风采集的媒体流,或更新订阅选项。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mediaStreamType | ByteRTCMediaStreamType | 媒体流类型,用于指定订阅音频/视频。参看 ByteRTCMediaStreamType。 |
返回值
0: 方法调用成功
!0: 方法调用失败
注意
- (int)unsubscribeStream:(NSString *_Nonnull)userId mediaStreamType:(ByteRTCMediaStreamType)mediaStreamType;
objectivec取消订阅房间内指定的通过摄像头/麦克风采集的媒体流。
该方法对自动订阅和手动订阅模式均适用。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userId | NSString* | 指定取消订阅的远端发布音视频流的用户 ID。 |
| mediaStreamType | ByteRTCMediaStreamType | 媒体流类型,用于指定取消订阅音频/视频。参看 ByteRTCMediaStreamType。 |
返回值
方法调用结果:
注意
- (int)unsubscribeAllStreamsWithMediaStreamType:(ByteRTCMediaStreamType)mediaStreamType;
objectivec取消订阅房间内所有的通过摄像头/麦克风采集的媒体流。
自动订阅和手动订阅的流都可以通过本方法取消订阅。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mediaStreamType | ByteRTCMediaStreamType | 媒体流类型,用于指定取消订阅音频/视频。参看 ByteRTCMediaStreamType。 |
返回值
方法调用结果:
注意
- (int)subscribeScreen:(NSString *_Nonnull)userId mediaStreamType:(ByteRTCMediaStreamType)mediaStreamType;
objectivec订阅房间内指定的远端屏幕共享音视频流,或更新对指定远端用户的订阅选项
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userId | NSString* | 指定订阅的远端发布屏幕流的用户 ID。 |
| mediaStreamType | ByteRTCMediaStreamType | 媒体流类型,用于指定订阅音频/视频。参看 ByteRTCMediaStreamType。 |
返回值
方法调用结果:
注意
- (int)unsubscribeScreen:(NSString *_Nonnull)userId mediaStreamType:(ByteRTCMediaStreamType)mediaStreamType;
objectivec取消订阅房间内指定的远端屏幕共享音视频流。
该方法对自动订阅和手动订阅模式均适用。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userId | NSString* | 指定取消订阅的远端发布屏幕流的用户 ID。 |
| mediaStreamType | ByteRTCMediaStreamType | 媒体流类型,用于指定取消订阅音频/视频。参看 ByteRTCMediaStreamType。 |
返回值
方法调用结果:
注意
- (int)pauseAllSubscribedStream:(ByteRTCPauseResumControlMediaType) mediaType;
objectivec暂停接收来自远端的媒体流
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mediaType | ByteRTCPauseResumControlMediaType | 媒体流类型,指定需要暂停接收音频还是视频流,参看 ByteRTCPauseResumControlMediaType |
返回值
注意
- (int)resumeAllSubscribedStream:(ByteRTCPauseResumControlMediaType) mediaType;
objectivec恢复接收来自远端的媒体流
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mediaType | ByteRTCPauseResumControlMediaType | 媒体流类型,指定需要恢复接收音频还是视频流,参看 ByteRTCPauseResumControlMediaType |
返回值
注意
- (NSInteger)sendUserMessage:(NSString *_Nonnull)userId message:(NSString *_Nonnull)message config:(ByteRTCMessageConfig)config;
objectivec给房间内指定的用户发送点对点文本消息(P2P)。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userId | NSString* | 消息接收用户的 ID |
| message | NSString* | 发送的文本消息内容。 消息不超过 64 KB。 |
| config | ByteRTCMessageConfig | 消息发送的可靠/有序类型,参看 ByteRTCMessageConfig |
返回值
这次发送消息的编号,从 1 开始递增。
注意
- (NSInteger)sendUserBinaryMessage:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message config:(ByteRTCMessageConfig)config;
objectivec给房间内指定的用户发送点对点二进制消息(P2P)。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 消息接收用户的 ID |
| message | NSData* | 发送的二进制消息内容 消息不超过 46KB。 |
| config | ByteRTCMessageConfig | 消息发送的可靠/有序类型,参看 ByteRTCMessageConfig。 |
返回值
这次发送消息的编号,从 1 开始递增。
注意
- (NSInteger)sendRoomMessage:(NSString *_Nonnull)message;
objectivec给房间内的所有其他用户群发文本消息。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| message | NSString* | 发送的文本消息内容。 消息不超过 64 KB。 |
返回值
这次发送消息的编号,从 1 开始递增。
注意
- (NSInteger)sendRoomBinaryMessage:(NSData * _Nonnull)message;
objectivec给房间内的所有其他用户群发二进制消息。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| message | NSData* | 用户发送的二进制广播消息 消息不超过 46KB。 |
返回值
这次发送消息的编号,从 1 开始递增。
注意
- (int)startForwardStreamToRooms:(NSArray <ByteRTCForwardStreamConfiguration *> * _Nullable)configurations;
objectivec开始跨房间转发媒体流。
在调用 joinRoom:userInfo:roomConfig: 后调用本接口,实现向多个房间转发媒体流,适用于跨房间连麦等场景。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| configurations | NSArray <ByteRTCForwardStreamConfiguration>** | 跨房间媒体流转发指定房间的信息。参看 ByteRTCForwardStreamConfiguration。 |
返回值
0: 方法调用成功
<0: 方法调用失败
注意
- (int)updateForwardStreamToRooms:(NSArray <ByteRTCForwardStreamConfiguration *> * _Nullable)configurations;
objectivec更新跨房间媒体流转发信息。
通过 startForwardStreamToRooms: 发起媒体流转发后,可调用本方法增加或者减少目标房间,或更新房间密钥。
调用本方法增加或删减房间后,将在本端触发 rtcRoom:onForwardStreamStateChanged: 回调,包含发生了变动的目标房间中媒体流转发状态。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| configurations | NSArray <ByteRTCForwardStreamConfiguration>** | 跨房间媒体流转发目标房间信息。参看 ByteRTCForwardStreamConfiguration。 |
返回值
注意
- (int)stopForwardStreamToRooms;
objectivec停止跨房间媒体流转发。
通过 startForwardStreamToRooms: 发起媒体流转发后,可调用本方法停止向所有目标房间转发媒体流。
返回值
注意
- (int)pauseForwardStreamToAllRooms;
objectivec暂停跨房间媒体流转发。
通过 startForwardStreamToRooms: 发起媒体流转发后,可调用本方法暂停向所有目标房间转发媒体流。
调用本方法暂停向所有目标房间转发后,你可以随时调用 resumeForwardStreamToAllRooms 快速恢复转发。
返回值
注意
调用本方法后,目标房间中的用户将接收到本地用户停止发布 rtcRoom:onUserUnpublishStream:type:reason: 和退房 rtcRoom:onUserLeave:reason: 的回调。
- (int)resumeForwardStreamToAllRooms;
objectivec恢复跨房间媒体流转发。
调用 pauseForwardStreamToAllRooms 暂停转发之后,调用本方法恢复向所有目标房间转发媒体流。
返回值
注意
目标房间中的用户将接收到本地用户进房 rtcRoom:onUserJoined:elapsed: 和发布 rtcRoom:onUserJoined:elapsed: 的回调。
- (ByteRTCRangeAudio *_Nullable)getRangeAudio;
objectivec获取范围语音接口实例。
返回值
方法调用结果:
注意
首次调用该方法须在创建房间后、加入房间前。范围语音相关 API 和调用时序详见范围语音。
- (ByteRTCSpatialAudio *_Nullable)getSpatialAudio;
objectivec获取空间音频接口实例。
返回值
方法调用结果:
注意
- (int)setRemoteRoomAudioPlaybackVolume:(NSInteger)volume;
objectivec调节某个房间内所有远端用户的音频播放音量。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| volume | NSInteger | 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。 • 0: 静音 • 100: 原始音量,默认值 • 400: 最大可为原始音量的 4 倍(自带溢出保护) |
返回值
注意
如果某远端用户 A 始终在被调节的目标用户范围内,
- (int)setAudioSelectionConfig:(ByteRTCAudioSelectionPriority)audioSelectionPriority;
objectivecAvailable since 3.52.
设置本端发布流在音频选路中的优先级。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioSelectionPriority | ByteRTCAudioSelectionPriority | 本端发布流在音频选路中的优先级,默认正常参与音频选路。参见 ByteRTCAudioSelectionPriority。 |
注意
在控制台上为本 appId 开启音频选路后,调用本接口才会生效。进房前后调用均可生效。更多信息参见音频选路。
如果本端用户同时加入不同房间,使用本接口进行的设置相互独立。
- (NSInteger)setRoomExtraInfo:(NSString *_Nonnull)key value:(NSString *_Nonnull)value;
objectivecAvailable since 3.52.
设置/更新房间附加信息,可用于标识房间状态或属性,或灵活实现各种业务逻辑。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| key | NSString* | 房间附加信息键值,长度小于 10 字节。 同一房间内最多可存在 5 个 key,超出则会从第一个 key 起进行替换。 |
| value | NSString* | 房间附加信息内容,长度小于 128 字节。 |
返回值
注意
- (int)startSubtitle:(ByteRTCSubtitleConfig *_Nonnull)subtitleConfig;
objectivecAvailable since 3.52
识别或翻译房间内所有用户的语音,形成字幕。
调用该方法时,可以在 ByteRTCSubtitleMode 中选择语音识别或翻译模式。如果选择识别模式,语音识别文本会通过 rtcRoom:onSubtitleMessageReceived: 事件回调给你;
如果选择翻译模式,你会同时收到两个 rtcRoom:onSubtitleMessageReceived: 回调,分别包含字幕原文及字幕译文。
调用该方法后,用户会收到 rtcRoom:onSubtitleStateChanged:errorCode:errorMessage: 回调,通知字幕是否开启。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| subtitleConfig | ByteRTCSubtitleConfig* | 字幕配置信息。参看 ByteRTCSubtitleConfig。 |
返回值
注意
流式语音识别,而非 音视频字幕生成。创建后,在 RTC 控制台 上启动流式语音识别,并填写创建语音技术应用时获取的相关信息,包括:APP ID,Access Token,和 Cluster ID。joinRoom 接口进房时,通过 extraInfo 参数传入格式为"语种英文名": "语种代号" JSON 字符串,例如设置源语言为英文时,传入 "source_language": "en"。如未指定源语言,SDK 会将系统语种设定为源语言。如果你的系统语种不是中文、英文和日文,此时 SDK 会自动将中文设为源语言。- (int)stopSubtitle;
objectivecAvailable since 3.52
关闭字幕。
调用该方法后,用户会收到 rtcRoom:onSubtitleStateChanged:errorCode:errorMessage: 回调,通知字幕是否关闭。
返回值
@interface ByteRTCVideo : NSObject
objectivec| 类型 | 名称 |
|---|---|
| id | delegate |
| 返回 | 名称 |
|---|---|
| void | destroyRTCVideo |
| NSString* | getSDKVersion |
| int | setLogConfig: |
| NSString* | getErrorDescription: |
@property (nonatomic, weak) id<ByteRTCVideoDelegate> _Nullable delegate;
objectivec+ (void)destroyRTCVideo;
objectivec销毁由 createRTCVideo:delegate:parameters: 所创建的引擎实例,并释放所有相关资源。
注意
+ (NSString * _Nonnull)getSDKVersion;
objectivec获取 SDK 当前的版本号。
返回值
SDK 当前的版本号。
+ (int) setLogConfig:(ByteRTCLogConfig *_Nonnull) logConfig;
objectivec配置 SDK 本地日志参数,包括日志级别、存储路径、日志文件最大占用的总空间、日志文件名前缀。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| logConfig | ByteRTCLogConfig* | 本地日志参数,参看 ByteRTCLogConfig。 |
返回值
注意
本方法必须在调用 createRTCVideo:delegate:parameters: 之前调用。
+ (NSString * _Nonnull)getErrorDescription:(NSInteger)code;
objectivec获取 SDK 内各种错误码、警告码的描述文字。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | NSInteger | 通过 rtcEngine:onWarning: 和 rtcEngine:onError: 回调获得的值, 具体可以参考 ByteRTCWarningCode 和 ByteRTCErrorCode 。 |
返回值
描述文字。
+ (ByteRTCVideo * _Nullable) createRTCVideo:(NSString * _Nonnull)appId delegate:(id<ByteRTCVideoDelegate> _Nullable)delegate parameters:(NSDictionary * _Nonnull)parameters;
objectivec创建引擎对象。
如果当前进程中未创建引擎实例,那么你必须先使用此方法,以使用 RTC 提供的各种音视频能力。
如果当前进程中已创建了引擎实例,再次调用此方法时,会返回已创建的引擎实例。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| appId | NSString* | 每个应用的唯一标识符,由 RTC 控制台随机生成的。 不同的 AppId 生成的实例在 RTC 中进行音视频通话完全独立,无法互通。 |
| delegate | id | SDK 回调给应用层的 delegate,详见 ByteRTCVideoDelegate |
| parameters | NSDictionary* | 私有参数。如需使用请联系技术支持人员。 |
返回值
可用的 ByteRTCVideo 实例
- (int)setAudioSourceType:(ByteRTCAudioSourceType) type;
objectivec切换音频采集方式
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCAudioSourceType | 音频数据源,详见 ByteRTCAudioSourceType。 默认使用内部音频采集。音频采集和渲染方式无需对应。 |
返回值
方法调用结果:
注意
- (int)setAudioRenderType:(ByteRTCAudioRenderType) type;
objectivec切换音频渲染方式
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCAudioRenderType | 音频输出类型,详见 ByteRTCAudioRenderType 默认使用内部音频渲染。音频采集和渲染方式无需对应。 |
返回值
方法调用结果:
注意
- (int)startAudioCapture;
objectivec开启内部音频采集。默认为关闭状态。
内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
调用该方法开启后,本地用户会收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error: 的回调。
可见用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStartAudioCapture:uid: 的回调。
返回值
注意
ByteRTCMediaDeviceError.ByteRTCMediaDeviceErrorDeviceNoPermission = 1。- (int)stopAudioCapture;
objectivec关闭内部音频采集。默认为关闭状态。
内部采集是指:使用 RTC SDK 内置的音频采集机制进行音频采集。
调用该方法,本地用户会收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error: 的回调。
可见用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStopAudioCapture:uid: 的回调。
返回值
注意
- (int)setAudioProfile:(ByteRTCAudioProfileType)audioProfile;
objectivec设置音质档位。
当所选的 ByteRTCRoomProfile 中的音频参数无法满足你的场景需求时,调用本接口切换的音质档位。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioProfile | ByteRTCAudioProfileType | 音质档位,参看 ByteRTCAudioProfileType |
返回值
注意
- (int)setAnsMode:(ByteRTCAnsMode)ansMode;
objectivec支持根据业务场景,设置通话中的音频降噪模式。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| ansMode | ByteRTCAnsMode | 降噪模式。具体参见 ByteRTCAnsMode。 |
返回值
注意
ChannelProfile 时,AI 降噪始终为关闭状态,调用本接口只能调整传统降噪强度:ByteRTCRoomProfileLowLatency, ByteRTCRoomProfileChorus 和 [Deprecated] ByteRTCRoomProfileLiveBroadcasting 。- (int)enableAGC:(BOOL)enable;
objectivecAvailable since 3.51
打开/关闭 AGC 功能
打开/关闭 AGC(Analog Automatic Gain Control)模拟自动增益控制功能。
开启该功能后,SDK 会自动调节麦克风的采集音量,确保音量稳定。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | BOOL | 是否打开 AGC 功能: • true: 打开 AGC 功能。 • false: 关闭 AGC 功能。 |
返回值
注意
该方法在进房前后均可调用。如果你需要在进房前使用 AGC 功能,请联系技术支持获得私有参数,传入对应 ByteRTCRoomProfile 。
要想在进房后开启 AGC 功能,你需要把 ByteRTCRoomProfile 设为 ByteRTCRoomProfileMeeting、ByteRTCRoomProfileMeetingRoom 或ByteRTCRoomProfileClassroom 。
AGC 功能生效后,不建议再调用 setAudioCaptureDeviceVolume: 来调节设备麦克风的采集音量。
- (int)setVoiceChangerType:(ByteRTCVoiceChangerType)voiceChanger;
objectivecAvailable since 3.32
设置变声特效类型
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| voiceChanger | ByteRTCVoiceChangerType | 变声特效类型,参看 ByteRTCVoiceChangerType。 |
返回值
方法调用结果:
注意
- (int)setVoiceReverbType:(ByteRTCVoiceReverbType)voiceReverb;
objectivecAvailable since 3.32
设置混响特效类型
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| voiceReverb | ByteRTCVoiceReverbType | 混响特效类型,参看 ByteRTCVoiceReverbType。 |
返回值
方法调用结果:
注意
-(int)setLocalVoiceEqualization:(ByteRTCVoiceEqualizationConfig* _Nonnull)config;
objectivec设置本地采集语音的均衡效果。包含内部采集和外部采集,但不包含混音音频文件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| config | ByteRTCVoiceEqualizationConfig* | 语音均衡效果,参看 ByteRTCVoiceEqualizationConfig |
返回值
注意
根据奈奎斯特采样率,音频采样率必须大于等于设置的中心频率的两倍,否则,设置不生效。
-(int)setLocalVoiceReverbParam:(ByteRTCVoiceReverbConfig* _Nonnull)param;
objectivec设置本地采集音频的混响效果。包含内部采集和外部采集,但不包含混音音频文件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| param | ByteRTCVoiceReverbConfig* | 混响效果,参看 ByteRTCVoiceReverbConfig |
返回值
注意
调用 enableLocalVoiceReverb: 开启混响效果。
-(int)enableLocalVoiceReverb:(bool)enable;
objectivec开启本地音效混响效果
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | bool | 是否开启 |
返回值
注意
调用 setLocalVoiceReverbParam: 设置混响效果。
- (int)setCaptureVolume:(ByteRTCStreamIndex)index volume:(int)volume;
objectivec调节音频采集音量
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| index | ByteRTCStreamIndex | 流索引,指定调节主流还是调节屏幕流的音量,参看 ByteRTCStreamIndex |
| volume | int | 采集的音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 • 0:静音 • 100:原始音量 • 400: 最大可为原始音量的 4 倍(自带溢出保护) |
返回值
注意
在开启音频采集前后,你都可以使用此接口设定采集音量。
- (int)setPlaybackVolume:(NSInteger)volume;
objectivec调节本地播放的所有远端用户音频混音后的音量,混音内容包括远端人声、音乐、音效等。
播放音频前或播放音频时,你都可以使用此接口设定播放音量。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| volume | NSInteger | 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。 为保证更好的通话质量,建议将 volume 值设为 [0,100]。 • 0: 静音 • 100: 原始音量 • 400: 最大可为原始音量的 4 倍(自带溢出保护) |
返回值
注意
如果某远端用户 A 始终在被调节的目标用户范围内,当该方法与 setRemoteAudioPlaybackVolume:remoteUid:playVolume: 或 setRemoteRoomAudioPlaybackVolume: 共同使用时,本地收听用户 A 的音量将为两次设置的音量效果的叠加。
- (int)enableAudioPropertiesReport:(ByteRTCAudioPropertiesConfig* _Nonnull)config;
objectivec启用音频信息提示。启用后,你可以收到 rtcEngine:onLocalAudioPropertiesReport:,rtcEngine:onRemoteAudioPropertiesReport:totalRemoteVolume:,和 rtcEngine:onActiveSpeaker:uid:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| config | ByteRTCAudioPropertiesConfig* | 详见 ByteRTCAudioPropertiesConfig |
返回值
- (int)setRemoteAudioPlaybackVolume:(NSString *_Nonnull)roomID remoteUid:(NSString *_Nonnull)userID playVolume:(NSInteger)volume;
objectivec调节来自指定远端用户的音频播放音量。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| roomID | NSString* | 音频来源用户所在的房间 ID |
| userID | NSString* | 音频来源的远端用户 ID |
| volume | NSInteger | 音频播放音量值和原始音量的比值,范围是 [0, 400],单位为 %,自带溢出保护。为保证更好的通话质量,建议将 volume 值设为 [0,100]。 • 0: 静音 • 100: 原始音量,默认值 • 400: 最大可为原始音量的 4 倍(自带溢出保护) |
返回值
注意
如果某远端用户 A 始终在被调节的目标用户范围内,
- (int)setEarMonitorMode:(ByteRTCEarMonitorMode)mode;
objectivec开启/关闭耳返功能。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mode | ByteRTCEarMonitorMode | 是否开启耳返功能,参看 ByteRTCEarMonitorMode。 |
返回值
注意
- (int)setEarMonitorVolume:(NSInteger)volume;
objectivec设置耳返的音量。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| volume | NSInteger | 耳返的音量,取值范围:[0,100],单位:% |
返回值
注意
设置耳返音量前,你必须先调用 setEarMonitorMode: 打开耳返功能。
- (int)setLocalVoicePitch:(NSInteger)pitch;
objectivec开启本地语音变调功能,多用于 K 歌场景。
使用该方法,你可以对本地语音的音调进行升调或降调等调整。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| pitch | NSInteger | 相对于语音原始音调的升高/降低值,取值范围[-12,12],默认值为 0,即不做调整。 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。 超出取值范围则设置失败,并且会触发 rtcEngine:onWarning: 回调,提示 ByteRTCWarningCode 错误码为 WARNING_CODE_SET_SCREEN_STREAM_INVALID_VOICE_PITCH 设置语音音调不合法 |
返回值
- (int)enableVocalInstrumentBalance:(BOOL)enable;
objectivec开启/关闭音量均衡功能。
开启音量均衡功能后,人声的响度会调整为 -16lufs。如果已调用 setAudioMixingLoudness:loudness: 传入了混音音乐的原始响度,此音乐播放时,响度会调整为 -20lufs。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | BOOL | 是否开启音量均衡功能: • YES: 是 • NO: 否 |
返回值
注意
该接口须在调用 startAudioMixing:filePath:config: 开始播放音频文件之前调用。
- (int)enablePlaybackDucking:(BOOL)enable;
objectivec打开/关闭音量闪避功能,适用于在 RTC 通话过程中会同时播放短视频或音乐的场景,如“一起看”、“在线 KTV”等。
开启该功能后,当检测到远端人声时,本地的媒体播放音量会自动减弱,从而保证远端人声的清晰可辨;当远端人声消失时,本地媒体音量会恢复到闪避前的音量水平。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | BOOL | 是否开启音量闪避: • YES: 是 • NO: 否 |
返回值
- (int)setLocalVideoSink:(ByteRTCStreamIndex)index withSink:(id<ByteRTCVideoSinkDelegate> _Nullable)videoSink withPixelFormat:(ByteRTCVideoSinkPixelFormat)requiredFormat;
objectivecDeprecated since 3.57, use setLocalVideoRender:withSink:withLocalRenderConfig: instead.
将本地视频流与自定义渲染器绑定。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| index | ByteRTCStreamIndex | 视频流属性。采集的视频流/屏幕视频流,参看 ByteRTCStreamIndex |
| videoSink | id | 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate |
| requiredFormat | ByteRTCVideoSinkPixelFormat | videoSink 适用的视频帧编码格式,参看 ByteRTCVideoSinkPixelFormat |
返回值
注意
- (int)setLocalVideoRender:(ByteRTCStreamIndex)index withSink:(id<ByteRTCVideoSinkDelegate> _Nullable)videoSink withLocalRenderConfig:(ByteRTCLocalVideoSinkConfig*)config;
objectivecAvailable since 3.57
将本地视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| index | ByteRTCStreamIndex | 视频流属性。采集的视频流/屏幕视频流,参看 ByteRTCStreamIndex。 |
| videoSink | id | 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate。 |
| config | ByteRTCLocalVideoSinkConfig* | 本地视频帧回调配置,参看 ByteRTCLocalVideoSinkConfig。 |
返回值
注意
- (int)setRemoteVideoSink:(ByteRTCRemoteStreamKey* _Nonnull)streamKey withSink:(id<ByteRTCVideoSinkDelegate> _Nullable)videoSink withPixelFormat:(ByteRTCVideoSinkPixelFormat)requiredFormat;
objectivecDeprecated since 3.57, use setRemoteVideoRender:withSink:withRemoteRenderConfig: instead.
将远端视频流与自定义渲染器绑定。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamKey | ByteRTCRemoteStreamKey* | 远端流信息,用于指定需要渲染的视频流来源及属性,参看 ByteRTCRemoteStreamKey |
| videoSink | id | 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate |
| requiredFormat | ByteRTCVideoSinkPixelFormat | videoSink 适用的视频帧编码格式,参看 ByteRTCVideoSinkPixelFormat |
返回值
注意
- (int)setRemoteVideoRender:(ByteRTCRemoteStreamKey* _Nonnull)streamKey withSink:(id<ByteRTCVideoSinkDelegate> _Nullable)videoSink withRemoteRenderConfig:(ByteRTCRemoteVideoSinkConfig*)config;
objectivecAvailable since 3.57
将远端视频流与自定义渲染器绑定。你可以通过参数设置返回指定位置和格式的视频帧数据。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamKey | ByteRTCRemoteStreamKey* | 远端流信息,用于指定需要渲染的视频流来源及属性,参看 ByteRTCRemoteStreamKey。 |
| videoSink | id | 自定义视频渲染器,参看 ByteRTCVideoSinkDelegate。 |
| config | ByteRTCRemoteVideoSinkConfig* | 远端视频帧回调配置,参看 ByteRTCRemoteVideoSinkConfig。 |
返回值
注意
- (int)setLowLightAdjusted:(ByteRTCVideoEnhancementMode)mode;
objectivecAvailable since 3.57
设置视频暗光增强模式。
对于光线不足、照明不均匀或背光等场景下推荐开启,可有效改善画面质量。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mode | ByteRTCVideoEnhancementMode | 默认不开启。参看 ByteRTCVideoEnhancementMode。 |
返回值
注意
- (int)setVideoEncoderConfig:(ByteRTCStreamIndex)streamIndex config:(NSArray <ByteRTCVideoSolution *> * _Nullable)videoSolutions __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.37 and will be deleted in 3.51, use setVideoEncoderConfig: instead.
设置推送多路流时的各路视频参数,包括分辨率、帧率、码率、缩放模式、网络不佳时的回退策略等。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 视频流属性,参看 ByteRTCStreamIndex。 |
| videoSolutions | NSArray <ByteRTCVideoSolution>** | 要推送的多路视频流参数,参看 ByteRTCVideoSolution。 最多支持 4 路参数。当设置了多路参数时,分辨率必须是从大到小排列。 最大分辨率为 4096px × 4096px,超过或设置的分辨率无法编码时,会导致编码推流失败。 |
返回值
注意
enableSimulcastMode 开启推送多路流模式。- (int)setVideoCaptureRotation:(ByteRTCVideoRotation)rotation;
objectivec设置本端采集的视频帧的旋转角度。
当摄像头倒置或者倾斜安装时,可调用本接口进行调整。对于手机等普通设备,可调用 setVideoRotationMode: 实现旋转。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| rotation | ByteRTCVideoRotation | 相机朝向角度,默认为 ByteRTCVideoRotation0,无旋转角度。详见 ByteRTCVideoRotation。 |
返回值
注意
- (int) enableSimulcastMode:(BOOL) enabled;
objectivec该方法设置视频流发布端是否开启发布多路编码参数不同的视频流的模式。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enabled | BOOL | 是否开启推送多路视频流模式: • YES:开启 • NO:关闭(默认) |
返回值
注意
- (int)setMaxVideoEncoderConfig:(ByteRTCVideoEncoderConfig * _Nullable) encoderConfig;
objectivec视频发布端设置期望发布的最大分辨率视频流参数,包括分辨率、帧率、码率、网络不佳时的回退策略等。
该接口支持设置一路视频流参数,设置多路参数请使用 setVideoEncoderConfig:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| encoderConfig | ByteRTCVideoEncoderConfig* | 期望发布的最大分辨率视频流参数。参看 ByteRTCVideoEncoderConfig。 |
返回值
方法调用结果:
注意
-(int)setVideoEncoderConfig:(NSArray <ByteRTCVideoEncoderConfig *> * _Nullable) encoderConfigs;
objectivec视频发布端设置推送多路流时各路流的参数,包括分辨率、帧率、码率、网络不佳时的回退策略等。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| encoderConfigs | NSArray <ByteRTCVideoEncoderConfig>** | 要推送的多路视频流的参数,最多支持设置 3 路参数,超过 3 路时默认取前 3 路的值。 当设置了多路参数时,分辨率和帧率必须是从大到小排列。需注意,所设置的分辨率是各路流的最大分辨率。参看 ByteRTCVideoEncoderConfig。 |
返回值
方法调用结果:
注意
-(int)setScreenVideoEncoderConfig:(ByteRTCScreenVideoEncoderConfig * _Nullable) encoderConfig;
objectivec为发布的屏幕共享视频流设置期望的编码参数,包括分辨率、帧率、码率、网络不佳时的回退策略等。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| encoderConfig | ByteRTCScreenVideoEncoderConfig* | 屏幕共享视频流参数。参看 ByteRTCScreenVideoEncoderConfig。 |
返回值
注意
-(int)setOriginalScreenVideoInfo:(int) originalCaptureWidth withOriginalCaptureHeight:(int)originalCaptureHeight;
objectivec外部采集时,当屏幕或待采集窗口大小发生改变,为了使 RTC 更好地决策合适的帧率和分辨率积,调用此接口设置改变前的分辨率。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| originalCaptureWidth | int | 首次采集屏幕流的宽度。 |
| originalCaptureHeight | int | 首次采集屏幕流的高度。 |
返回值
注意
- (int)setVideoCaptureConfig:(ByteRTCVideoCaptureConfig * _Nullable)captureConfig;
objectivec设置 RTC SDK 内部采集时的视频采集参数。
如果你的项目使用了 SDK 内部采集模块,可以通过本接口指定视频采集参数包括模式、分辨率、帧率。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| captureConfig | ByteRTCVideoCaptureConfig* | 视频采集参数。参看: ByteRTCVideoCaptureConfig。 |
返回值
注意
- (int)setLocalVideoCanvas:(ByteRTCStreamIndex)streamIndex withCanvas:(ByteRTCVideoCanvas * _Nullable)canvas;
objectivec设置本地视频渲染时使用的视图,并设置渲染模式。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 流属性,参看 ByteRTCStreamIndex |
| canvas | ByteRTCVideoCanvas* | 视图信息和渲染模式,参看 ByteRTCVideoCanvas |
返回值
注意
- (int)updateLocalVideoCanvas:(ByteRTCStreamIndex)streamIndex withRenderMode:(ByteRTCRenderMode)renderMode withBackgroundColor:(NSUInteger)backgroundColor;
objectivec修改本地视频渲染模式和背景色。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 视频流属性。参看 ByteRTCStreamIndex |
| renderMode | ByteRTCRenderMode | 渲染模式。参看 ByteRTCRenderMode |
| backgroundColor | NSUInteger | 背景颜色。参看 ByteRTCVideoCanvas.backgroundColor |
返回值
注意
你可以在本地视频渲染过程中,调用此接口。调用结果会实时生效。
- (int)setRemoteVideoCanvas:(ByteRTCRemoteStreamKey * _Nonnull)key withCanvas:(ByteRTCVideoCanvas * _Nullable)canvas;
objectivec渲染来自指定远端用户 uid 的视频流时,设置使用的视图和渲染模式。
如果需要解除视频的绑定视图,把 canvas.view 设置为空。(canvas 中其他参数不能为空。)
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| key | ByteRTCRemoteStreamKey* | 远端流信息, 详见 ByteRTCRemoteStreamKey。 |
| canvas | ByteRTCVideoCanvas* | 视图信息和渲染模式,参看 ByteRTCVideoCanvas。3.56 版本起支持通过 renderRotation 设置远端视频渲染的旋转角度。 |
返回值
注意
本地用户离开房间时,会解除调用此 API 建立的绑定关系;远端用户离开房间则不会影响。
- (int)updateRemoteStreamVideoCanvas:(ByteRTCRemoteStreamKey * _Nonnull)key withRenderMode:(ByteRTCRenderMode)renderMode withBackgroundColor:(NSUInteger)backgroundColor;
objectivecDeprecated 从 3.56起, 将在3.62删除,使用updateRemoteStreamVideoCanvas替代。
修改远端视频帧的渲染设置,包括渲染模式和背景颜色。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| key | ByteRTCRemoteStreamKey* | 远端流信息, 详见 ByteRTCRemoteStreamKey |
| renderMode | ByteRTCRenderMode | 渲染模式,参看 ByteRTCRenderMode |
| backgroundColor | NSUInteger | 背景颜色,参看 ByteRTCVideoCanvas.backgroundColor |
返回值
注意
你可以在远端视频渲染过程中,调用此接口。调用结果会实时生效。
- (int)startVideoCapture;
objectivec立即开启内部视频采集。默认为关闭状态。
内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error: 的回调。
可见用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStartVideoCapture:uid: 的回调。
返回值
注意
- (int)stopVideoCapture;
objectivec立即关闭内部视频采集。默认为关闭状态。
内部视频采集指:使用 RTC SDK 内置视频采集模块,进行采集。
调用该方法后,本地用户会收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error: 的回调。
可见用户进房后调用该方法,房间中的其他用户会收到 rtcEngine:onUserStopVideoCapture:uid: 的回调。
返回值
注意
- (int)setLocalVideoMirrorType:(ByteRTCMirrorType) mirrorType;
objectivec为采集到的视频流开启镜像
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mirrorType | ByteRTCMirrorType | 镜像类型,参看 ByteRTCMirrorType |
返回值
注意
mirrorType 支持设置为 0(无镜像)和 3(本地预览和编码传输镜像),不支持设置为 1(本地预览镜像)。| 前置摄像头 | 后置摄像头 | 自定义采集视频源 | 桌面端摄像头 | |
|---|---|---|---|---|
| 移动端 | 本地预览镜像,编码传输不镜像 | 本地预览不镜像,编码传输不镜像 | 本地预览不镜像,编码传输不镜像 | / |
| 桌面端 | / | / | 本地预览不镜像,编码传输不镜像 | 本地预览镜像,编码传输不镜像 |
- (int)setRemoteVideoMirrorType:(ByteRTCRemoteStreamKey*)key withMirrorType:(ByteRTCRemoteMirrorType)mirrorType;
objectivecAvailable since 3.57
使用内部渲染时,为远端流开启镜像。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| key | ByteRTCRemoteStreamKey* | 远端流信息,用于指定需要镜像的视频流来源及属性,参看 ByteRTCRemoteStreamKey。 |
| mirrorType | ByteRTCRemoteMirrorType | 远端流的镜像类型,参看 ByteRTCRemoteMirrorType。 |
返回值
- (ByteRTCVideoEffect* _Null_unspecified)getVideoEffectInterface;
objectivec获取视频特效接口。
返回值
视频特效接口,参看 ByteRTCVideoEffect。
- (int)getAuthMessage:(NSString *_Nullable*_Nullable)ppmsg;
objectivecDeprecated since 3.50 and will be deleted in 3.55, use getAuthMessage: instead.
从特效 SDK 获取授权消息,用于获取在线许可证。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| ppmsg | NSString** | 授权消息字符串地址 |
返回值
注意
- (int)checkVideoEffectLicense:(NSString * _Nonnull)licenseFile;
objectivecDeprecated since 3.50 and will be deleted in 3.55, use initCVResource:withAlgoModelDir: instead.
视频特效许可证检查
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| licenseFile | NSString* | 许可证文件绝对路径 |
返回值
注意
enableVideoEffect 开始使用视频特效前,需要先调用这个方法进行许可证验证
- (void)setVideoEffectAlgoModelPath:(NSString * _Nonnull)modelPath __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.50 and will be deleted in 3.55, use initCVResource:withAlgoModelDir: instead.
设置视频特效算法模型路径
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| modelPath | NSString* | 模型路径 |
- (int)enableVideoEffect:(BOOL)enabled;
objectivecDeprecated since 3.50 and will be deleted in 3.55, use enableVideoEffect instead.
创建/销毁视频特效引擎
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enabled | BOOL | 是否创建视频特效引擎 • YES: 创建 • NO: 销毁 |
返回值
注意
- (int) setVideoEffectNodes:(NSArray <NSString *> *_Nonnull)effectNodePaths __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.50 and will be deleted in 3.55, use setEffectNodes: instead.
设置视频特效素材包
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectNodePaths | NSArray <NSString>** | 特效素材包路径数组 要取消当前视频特效,将此参数设置为 null。 |
返回值
注意
在调用这个方法之前,你须先调用 enableVideoEffect 。
- (int) updateVideoEffectNode:(NSString * _Nonnull)nodePath nodeKey:(NSString * _Nonnull)nodeKey nodeValue:(float) nodeValue;
objectivecDeprecated since 3.50 and will be deleted in 3.55, use updateEffectNode:key:value: instead.
设置特效强度
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| nodePath | NSString* | 特效素材包路径。 |
| nodeKey | NSString* | 需要设置的素材 key 名称。参看 素材key对应说明。 |
| nodeValue | float | 需要设置的强度值。取值范围为 [0,1],超出该范围设置无效。 |
返回值
注意
该接口仅适用于同时含有上述三个参数的特效资源,对于如大部分贴纸类等没有强度参数的特效,该接口调用无效。
- (int) setVideoEffectColorFilter:(NSString * _Nonnull)resPath __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.50 and will be deleted in 3.55, use setColorFilter: instead.
设置颜色滤镜
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| resPath | NSString* | 滤镜资源包绝对路径 |
返回值
- (int) setVideoEffectColorFilterIntensity:(float) intensity __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.50 and will be deleted in 3.55, use setColorFilterIntensity: instead.
设置已启用的颜色滤镜强度
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| intensity | float | 滤镜强度。取值范围 [0,1],超出范围时设置无效 |
返回值
- (int) setBackgroundSticker:(NSString* _Nullable)modelPath source:(ByteRTCVirtualBackgroundSource* _Nonnull)source __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.50 and will be deleted in 3.55, use enableVirtualBackground:withSource: instead.
将摄像头采集画面中的人像背景替换为指定图片或纯色背景。
若要取消背景特效,将背景贴纸特效素材路径设置为null。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| modelPath | NSString* | 传入背景贴纸特效素材路径。 |
| source | ByteRTCVirtualBackgroundSource* | 设置背景特效图片的本地路径。参看 ByteRTCVirtualBackgroundSource。 |
返回值
注意
调用此接口前需依次调用以下接口:1、检查视频特效许可证 initCVResource:withAlgoModelDir:;2、设置视频特效算法模型路径 setVideoEffectAlgoModelPath:;3、开启视频特效 enableVideoEffect。
- (int) registerFaceDetectionObserver:(_Nullable id<ByteRTCFaceDetectionObserver>)faceDetectionObserver withInterval:(NSInteger)interval;
objectivecDeprecated since 3.50 and will be deleted in 3.55, use registerFaceDetectionObserver:withInterval: instead.
注册人脸检测结果回调观察者
注册此观察者后,你会周期性收到 onFaceDetectResult: 回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| faceDetectionObserver | id | 人脸检测结果回调观察者,参看 ByteRTCFaceDetectionObserver。 |
| interval | NSInteger | 时间间隔,必须大于 0。单位:ms。实际收到回调的时间间隔大于 interval,小于 interval • 视频采集帧间隔。 |
返回值
- (int) enableEffectBeauty:(BOOL)enable;
objectivec开启/关闭基础美颜。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | BOOL | 基础美颜开关 • YES: 开启基础美颜 • NO: 关闭基础美颜(默认) |
返回值
注意
- (int) setBeautyIntensity:(ByteRTCEffectBeautyMode) beautyMode withIntensity:(float)intensity;
objectivec调整基础美颜强度。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| beautyMode | ByteRTCEffectBeautyMode | 基础美颜模式,参看 ByteRTCEffectBeautyMode。 |
| intensity | float | 美颜强度,取值范围为 [0,1]。强度为 0 表示关闭。 各基础美颜模式的强度默认值分别为:美白 0.7,磨皮 0.8,锐化 0.5,清晰 0.7。 |
返回值
注意
- (int)sendSEIMessage:(ByteRTCStreamIndex)streamIndex andMessage:(NSData* _Nonnull)message andRepeatCount:(int)repeatCount __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.50 and will be deleted in 3.55, use sendSEIMessage:andMessage:andRepeatCount:andCountPerFrame: instead.
通过视频帧发送 SEI 数据。
在视频通话场景下,SEI 数据会随视频帧发送;在语音通话场景下,SDK 会自动生成一路 16px × 16px 的黑帧视频流用来发送 SEI 数据。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 指定携带 SEI 数据的媒体流类型,参看 ByteRTCStreamIndex。 语音通话场景下,该值需设为 ByteRTCStreamIndexMain,否则 SEI 数据会被丢弃从而无法送达远端。 |
| message | NSData* | SEI 消息。长度不超过 4KB。 |
| repeatCount | int | 消息发送重复次数。取值范围是 [0, 30]。 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 repeatCount+1 个视频帧中。 |
返回值
注意
- (int)sendSEIMessage:(ByteRTCStreamIndex)streamIndex andMessage:(NSData* _Nonnull)message andRepeatCount:(int)repeatCount andCountPerFrame:(ByteRTCSEICountPerFrame) mode;
objectivec通过视频帧发送 SEI 数据。
在视频通话场景下,SEI 数据会随视频帧发送;在语音通话场景下,SDK 会自动生成一路 16px × 16px 的黑帧视频流用来发送 SEI 数据。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 指定携带 SEI 数据的媒体流类型,参看 ByteRTCStreamIndex。 语音通话场景下,该值需设为 ByteRTCStreamIndexMain,否则 SEI 数据会被丢弃从而无法送达远端。 |
| message | NSData* | SEI 消息,建议每帧 SEI 数据总长度长度不超过 4 KB。 |
| repeatCount | int | 消息发送重复次数。取值范围是 [0, max{29, %{视频帧率}-1}]。推荐范围 [2,4]。 调用此接口后,SEI 数据会添加到从当前视频帧开始的连续 repeatCount+1 个视频帧中。 |
| mode | ByteRTCSEICountPerFrame | SEI 发送模式,参看 ByteRTCSEICountPerFrame。 |
返回值
注意
- (int)setVideoDigitalZoomConfig:(ByteRTCZoomConfigType)type size:(float)size;
objectivecAvailable since 3.51
设置本地摄像头数码变焦参数,包括缩放倍数,移动步长。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCZoomConfigType | 数码变焦参数类型,缩放系数或移动步长。参看 ByteRTCZoomConfigType。必填。 |
| size | float | 缩放系数或移动步长,保留到小数点后三位。默认值为 0。必填。 选择不同 type 时有不同的取值范围。当计算后的结果超过缩放和移动边界时,取临界值。• ByteRTCZoomConfigTypeFocusOffset:缩放系数增量,范围为 [0, 7]。例如,设置为 0.5 时,如果调用 setVideoDigitalZoomControl: 选择 Zoom in,则缩放系数增加 0.5。缩放系数范围 [1,8],默认为 1,原始大小。• ByteRTCZoomConfigTypeMoveOffset:移动百分比,范围为 [0, 0.5],默认为 0,不移动。如果调用 setVideoDigitalZoomControl: 选择的是左右移动,则移动距离为 size x 原始视频宽度;如果选择的是上下移动,则移动距离为 size x 原始视频高度。例如,视频帧边长为 1080 px,设置为 0.5 时,实际移动距离为 0.5 x 1080 px = 540 px。 |
返回值
注意
0 ,在调用 setVideoDigitalZoomControl: 或 startVideoDigitalZoomControl: 进行数码变焦操作前,应先调用本接口。- (int)setVideoDigitalZoomControl:(ByteRTCZoomDirectionType) direction;
objectivecAvailable since 3.51
控制本地摄像头数码变焦,缩放或移动一次。设置对本地预览画面和发布到远端的视频都生效。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| direction | ByteRTCZoomDirectionType | 数码变焦操作类型,参看 ByteRTCZoomDirectionType。 |
返回值
注意
0,调用该方法前需通过 setVideoDigitalZoomConfig:size: 设置参数。- (int)startVideoDigitalZoomControl:(ByteRTCZoomDirectionType)direction;
objectivecAvailable since 3.51
开启本地摄像头持续数码变焦,缩放或移动。设置对本地预览画面和发布到远端的视频都生效。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| direction | ByteRTCZoomDirectionType | 数码变焦操作类型,参看 ByteRTCZoomDirectionType。 |
返回值
注意
0,调用该方法前需通过 setVideoDigitalZoomConfig:size: 设置参数。- (int)stopVideoDigitalZoomControl;
objectivecAvailable since 3.51
停止本地摄像头持续数码变焦。
返回值
注意
关于开始数码变焦,参看 startVideoDigitalZoomControl:。
- (int)registerLocalVideoProcessor:(_Nullable id<ByteRTCVideoProcessorDelegate>) processor withConfig:(ByteRTCVideoPreprocessorConfig* _Nullable)config;
objectivec设置自定义视频前处理器。
使用这个视频前处理器,你能够调用 processVideoFrame: 对 RTC SDK 采集得到的视频帧进行前处理,并将处理后的视频帧用于 RTC 音视频通信。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| processor | id | 自定义视频处理器,详见 ByteRTCVideoProcessorDelegate。如果传入 null,则不对 RTC SDK 采集得到的视频帧进行前处理。 SDK 只持有 processor 的弱引用,你应保证其生命周期。 在设计 processor 时,应从 ByteRTCVideoFrame 的 textureBuf 字段获取视频帧数据;处理后返回的视频帧数据格式应为 ByteRTCVideoPixelFormat 中的 ByteRTCVideoPixelFormatCVPixelBuffer,且必须存放在返回帧数据的 textureBuf 字段中。 |
| config | ByteRTCVideoPreprocessorConfig* | 自定义视频前处理器适用的设置,详见 ByteRTCVideoPreprocessorConfig。 当前, config 中的 required_pixel_format 仅支持:ByteRTCVideoPixelFormatI420 和 ByteRTCVideoPixelFormatUnknown:• 设置为 Unknown 时,RTC SDK 给出供 processor 处理的视频帧格式即采集的格式。• 设置为 ByteRTCVideoPixelFormatI420 时,RTC SDK 会将采集得到的视频转变为对应的格式,供前处理使用。• 设置为其他值时,此方法调用失败。 |
返回值
注意
kVideoPixelFormatUnknown,可以通过避免格式转换带来一些性能优化。- (int)registerLocalEncodedVideoFrameObserver:(_Nullable id<ByteRTCLocalEncodedVideoFrameObserver>) frameObserver;
objectivec注册本地视频帧监测器。
无论使用内部采集还是自定义采集,调用该方法后,SDK 每监测到一帧本地视频帧时,都会将视频帧信息通过 onLocalEncodedVideoFrame:Frame: 回调给用户
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| frameObserver | id | 本地视频帧监测器,参看 ByteRTCLocalEncodedVideoFrameObserver。将参数设置为 nullptr 则取消注册。 |
返回值
注意
该方法可在进房前后任意时间调用,在进房前调用可保证尽可能早地监测视频帧并触发回调
- (int)enableExternalSoundCard:(bool)enable;
objectivec启用匹配外置声卡的音频处理模式
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | bool | • true: 开启 • false: 不开启(默认) |
返回值
注意
- (int)startLiveTranscoding:(NSString * _Nonnull)taskID transcoding:(ByteRTCLiveTranscoding *_Nullable)transcoding observer:(id<LiveTranscodingDelegate> _Nullable)observer __deprecated_msg("deprecated since 352, will be deleted in 358, use startPushMixedStreamToCDN instead");
objectivecDeprecated since 3.52, will be deleted in 3.58, use startPushMixedStreamToCDN:mixedConfig:observer: instead.
新增转推直播任务,并设置合流的图片、视频视图布局和音频属性。
同一个任务中转推多路直播流时,SDK 会先将多路流合成一路流,然后再进行转推。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| taskID | NSString* | 转推直播任务 ID,长度不超过 126 字节。 你可以在同一房间内发起多个转推直播任务,并用不同的任务 ID 加以区分。当你需要发起多个转推直播任务时,应使用多个 ID;当你仅需发起一个转推直播任务时,建议使用空字符串。 |
| transcoding | ByteRTCLiveTranscoding* | 转推直播配置参数,详见 ByteRTCLiveTranscoding。 |
| observer | id | 端云一体转推直播观察者。详见 LiveTranscodingDelegate。 通过注册 observer 接收转推直播相关的回调。 |
返回值
注意
- (int)stopLiveTranscoding:(NSString *_Nonnull)taskID __deprecated_msg("deprecated since 352, will be deleted in 358, use stopPushStreamToCDN instead");
objectivecDeprecated since 3.52, will be deleted in 3.58, use stopPushStreamToCDN: instead.
停止转推直播,会收到 onStreamMixingEvent:taskId:error:mixType: 回调。
关于启动转推直播,参看 startLiveTranscoding:transcoding:observer:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| taskID | NSString* | 转推直播任务 ID。可以指定想要停止的转推直播任务。 |
返回值
- (int)updateLiveTranscoding:(NSString *_Nonnull)taskID transcoding:(ByteRTCLiveTranscoding *_Nonnull)transcoding __deprecated_msg("deprecated since 352, will be deleted in 358, use updatePushMixedStreamToCDN instead");
objectivecDeprecated since 3.52, will be deleted in 3.58, use updatePushMixedStreamToCDN:mixedConfig: instead.
更新转推直播参数,会收到 onStreamMixingEvent:taskId:error:mixType: 回调。
开启转推直播功能后,你可以使用此方法更新合流转推功能配置参数。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| taskID | NSString* | 转推直播任务 ID。指定想要更新参数设置的转推直播任务。 |
| transcoding | ByteRTCLiveTranscoding* | 转推直播配置参数,参看 ByteRTCLiveTranscoding。除特殊说明外,均支持过程中更新。 调用时,结构体中没有传入值的属性,会被更新为默认值。 |
返回值
方法调用结果。
- (int)startPushMixedStreamToCDN:(NSString * _Nonnull)taskID mixedConfig:(ByteRTCMixedStreamConfig *_Nullable)config observer:(id<ByteRTCMixedStreamObserver> _Nullable)observer;
objectivecAvailable since 3.52
新增合流转推直播任务,并设置合流的图片、视频视图布局和音频属性。
同一个任务中转推多路直播流时,SDK 会先将多路流合成一路流,然后再进行转推。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| taskID | NSString* | 转推直播任务 ID,长度不超过 126 字节。 你可以在同一房间内发起多个转推直播任务,并用不同的任务 ID 加以区分。当你需要发起多个转推直播任务时,应使用多个 ID;当你仅需发起一个转推直播任务时,建议使用空字符串。 |
| config | ByteRTCMixedStreamConfig* | 转推直播配置参数,详见 ByteRTCMixedStreamConfig。 |
| observer | id | 端云一体转推直播观察者。详见 ByteRTCMixedStreamObserver。 通过注册 observer 接收转推直播相关的回调。 |
返回值
方法调用结果。
注意
- (int)updatePushMixedStreamToCDN:(NSString *_Nonnull)taskID mixedConfig:(ByteRTCMixedStreamConfig *_Nonnull)config;
objectivecAvailable since 3.52
更新合流转推直播参数,会收到 onMixingEvent:taskId:error:mixType: 回调。
开启转推直播功能后,你可以使用此方法更新合流转推功能配置参数。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| taskID | NSString* | 转推直播任务 ID。指定想要更新参数设置的转推直播任务。 |
| config | ByteRTCMixedStreamConfig* | 转推直播配置参数,参看 ByteRTCMixedStreamConfig。除特殊说明外,均支持过程中更新。 |
返回值
方法调用结果。
- (int)startPushSingleStreamToCDN:(NSString *_Nonnull)taskID singleStream:(ByteRTCPushSingleStreamParam *_Nonnull)singleStream observer:(id<ByteRTCPushSingleStreamToCDNObserver>_Nullable)observer;
objectivec新增单流转推直播任务。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| taskID | NSString* | 任务 ID。 你可以发起多个转推直播任务,并用不同的任务 ID 加以区分。当你需要发起多个转推直播任务时,应使用多个 ID;当你仅需发起一个转推直播任务时,建议使用空字符串。 |
| singleStream | ByteRTCPushSingleStreamParam* | 转推直播配置参数。详见 ByteRTCPushSingleStreamParam。 |
| observer | id | 单流转推直播观察者。详见 ByteRTCPushSingleStreamToCDNObserver。 通过注册 observer 接收单流转推直播相关的回调。 |
返回值
注意
- (int)stopPushStreamToCDN:(NSString *_Nonnull)taskID;
objectivec停止转推直播。
该方法可用于停止单流转推直播或停止合流转推直播,通过 taskId 区分需要停止的任务。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| taskID | NSString* | 任务 ID。可以指定想要停止的单流转推直播或合流转推直播任务。 |
返回值
注意
- (int)startPushPublicStream:(NSString * _Nonnull)publicStreamId withLayout:(ByteRTCPublicStreaming *_Nullable)publicStream;
objectivec发布一路公共流
用户可以指定房间内多个用户发布的媒体流合成一路公共流。使用同一 appID 的用户,可以调用 startPlayPublicStream: 获取和播放指定的公共流。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| publicStreamId | NSString* | 公共流 ID。 |
| publicStream | NSString* | 公共流参数。详见 ByteRTCPublicStreaming。 一路公共流可以包含多路房间内的媒体流,按照指定的布局方式进行聚合。 如果指定的媒体流还未发布,则公共流将在指定流开始发布后实时更新。 |
返回值
注意
- (int)stopPushPublicStream:(NSString * _Nonnull)publicStreamId;
objectivec停止发布当前用户发布的公共流
关于发布公共流,查看 startPushPublicStream:withLayout:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| publicStreamId | NSString* | 公共流 ID 指定的流必须为当前用户所发布。 |
返回值
- (int)updatePublicStreamParam:(NSString * _Nonnull)publicStreamId withLayout:(ByteRTCPublicStreaming *_Nullable)publicStream;
objectivec更新公共流参数
关于发布公共流,查看 startPushPublicStream:withLayout:。
建议调用更新公共流前判断公共流是否已经成功启动,相关回调详见 rtcEngine:onPushPublicStreamResult:publicStreamId:errorCode:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| publicStreamId | NSString* | 公共流ID 指定的流必须为当前用户所发布的。 |
| publicStream | NSString* | 推公共流配置参数。详见 ByteRTCPublicStreaming。 |
返回值
- (int)startPlayPublicStream:(NSString * _Nonnull)publicStreamId;
objectivec订阅指定公共流
无论用户是否在房间内,都可以调用本接口获取和播放指定的公共流。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| publicStreamId | NSString* | 公共流ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 |
返回值
注意
- (int)stopPlayPublicStream:(NSString * _Nonnull)publicStreamId;
objectivec取消订阅指定公共流
关于订阅公共流,查看 startPlayPublicStream:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| publicStreamId | NSString* | 公共流ID |
返回值
- (int)setPublicStreamVideoCanvas:(NSString *_Nonnull)publicStreamId withCanvas:(ByteRTCVideoCanvas * _Nullable)canvas;
objectivec为指定公共流绑定内部渲染视图。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| publicStreamId | NSString* | 公共流ID |
| canvas | ByteRTCVideoCanvas* | 内部渲染视图,如果需要解除视频的绑定视图,把 videoCanvas 设置为空。详见 ByteRTCVideoCanvas |
返回值
- (int)setPublicStreamVideoSink:(NSString *_Nonnull)publicStreamId withSink:(id<ByteRTCVideoSinkDelegate> _Nullable)videoSink withPixelFormat:(ByteRTCVideoSinkPixelFormat)requiredFormat;
objectivec为指定公共流绑定自定义渲染器。详见自定义视频渲染。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| publicStreamId | NSString* | 公共流ID |
| videoSink | id | 自定义视频渲染器,需要释放渲染器资源时,将 videoSink 设置为 null。参看 ByteRTCVideoSinkDelegate |
| requiredFormat | ByteRTCVideoSinkPixelFormat | videoSink 适用的视频帧编码格式,参看 ByteRTCVideoSinkPixelFormat |
返回值
- (int)setPublicStreamAudioPlaybackVolume:(NSString *_Nonnull)publicStreamId volume:(NSInteger)volume;
objectivecAvailable since 3.51
调节公共流的音频播放音量。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| publicStreamId | NSString* | 公共流 ID |
| volume | NSInteger | 音频播放音量值和原始音量值的比值,该比值的范围是 [0, 400],单位为 %,且自带溢出保护。为保证更好的音频质量,建议设定在 [0, 100] 之间,其中 100 为系统默认值。 |
返回值
- (int)pushExternalVideoFrame:(ByteRTCVideoFrame * _Nonnull)frame;
objectivec推送外部视频帧。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| frame | ByteRTCVideoFrame* | 该视频帧包含待 SDK 编码的视频数据,参考 ByteRTCVideoFrame。 |
返回值
方法调用结果:
注意
推送外部视频帧前,必须调用 setVideoSourceType:WithStreamIndex: 开启外部视频源采集。
- (int)enableAudioFrameCallback:(ByteRTCAudioFrameCallbackMethod) method format:(ByteRTCAudioFormat* _Nullable)format;
objectivec设置并开启指定的音频数据帧回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| method | ByteRTCAudioFrameCallbackMethod | 音频回调方法,参看 ByteRTCAudioFrameCallbackMethod。 当音频回调方法设置为 0、1、2时,你需要在参数 format 中指定准确的采样率和声道,暂不支持设置为自动。 当音频回调方法设置为 3时,应将 format 的字段设置为默认值。 |
| format | ByteRTCAudioFormat* | 音频参数格式,参看 ByteRTCAudioFormat。 |
返回值
注意
开启音频回调并调用 registerAudioFrameObserver: 后,ByteRTCAudioFrameObserver 会收到对应的音频回调。两者调用顺序没有限制且相互独立。
- (int)disableAudioFrameCallback:(ByteRTCAudioFrameCallbackMethod) method;
objectivec关闭音频回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| method | ByteRTCAudioFrameCallbackMethod | 音频回调方法,参看 ByteRTCAudioFrameCallbackMethod。 |
返回值
注意
该方法需要在调用 enableAudioFrameCallback:format: 之后调用。
- (int)registerAudioFrameObserver:(_Nullable id<ByteRTCAudioFrameObserver>) audioFrameObserver;
objectivec注册音频数据回调观察者。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrameObserver | id | 音频数据观察者,参看 ByteRTCAudioFrameObserver。如果传入 null,则取消注册。 |
返回值
注意
注册音频数据回调观察者并调用 enableAudioFrameCallback:format: 后,ByteRTCAudioFrameObserver 会收到对应的音频回调。对回调中收到的音频数据进行处理,不会影响 RTC 的编码发送或渲染。
- (int)registerAudioProcessor:(_Nullable id<ByteRTCAudioFrameProcessor>)processor;
objectivec注册自定义音频处理器。
注册完成后,你可以调用 enableAudioProcessor:audioFormat:,对本地采集到的音频进行处理,RTC SDK 将对处理后的音频进行编码和发送。也可以对接收到的远端音频进行自定义处理,RTC SDK 将对处理后的音频进行渲染。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| processor | id | 自定义音频处理器,详见 ByteRTCAudioFrameProcessor。 SDK 只持有 processor 的弱引用,你应保证其生命周期。需要取消注册时,设置此参数为 nullptr。 |
返回值
注意
- (int)enableAudioProcessor:(ByteRTCAudioFrameMethod)method audioFormat:(ByteRTCAudioFormat *_Nullable)format;
objectivec设置并开启指定的音频帧回调,进行自定义处理。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| method | ByteRTCAudioFrameMethod | 音频帧类型,参看 ByteRTCAudioFrameMethod。可多次调用此接口,处理不同类型的音频帧。 选择不同类型的音频帧将收到对应的回调: • 选择本地采集的音频时,会收到 onProcessRecordAudioFrame:。 • 选择远端音频流的混音音频时,会收到 onProcessPlayBackAudioFrame:。 • 选择远端音频流时,会收到 onProcessRemoteUserAudioFrame:audioFrame:。 • 选择软件耳返音频时,会收到 onProcessEarMonitorAudioFrame:。(仅适用于 iOS 平台) • 选择屏幕共享音频流时,会收到 onProcessScreenAudioFrame:。 |
| format | ByteRTCAudioFormat* | 设定自定义处理时获取的音频帧格式,参看 ByteRTCAudioFormat。 |
返回值
注意
- (int)disableAudioProcessor:(ByteRTCAudioFrameMethod)method;
objectivec关闭自定义音频处理。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| method | ByteRTCAudioFrameMethod | 音频帧类型,参看 ByteRTCAudioFrameMethod。 |
返回值
- (int)pushExternalAudioFrame:(ByteRTCAudioFrame * _Nonnull) audioFrame;
objectivec推送自定义采集的音频数据到 RTC SDK。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 音频数据帧,详见 ByteRTCAudioFrame • 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 • 必须指定具体的采样率和声道数,不支持设置为自动。 |
返回值
方法调用结果
注意
- (int)pullExternalAudioFrame:(ByteRTCAudioFrame * _Nonnull) audioFrame;
objectivec拉取下行音频数据用于自定义音频渲染。
调用该方法后,SDK 会主动拉取待播放的音频数据,包括远端已解码和混音后的音频数据,用于外部播放。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 音频数据帧,详见 ByteRTCAudioFrame |
返回值
方法调用结果
注意
- (int)setBusinessId:(NSString* _Nullable)businessId;
objectivec设置业务标识参数
可通过 businessId 区分不同的业务场景。businessId 由客户自定义,相当于一个“标签”,可以分担和细化现在 AppId 的逻辑划分的功能,但不需要鉴权。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| businessId | NSString* | 用户设置的自己的 businessId 值 businessId 只是一个标签,颗粒度需要用户自定义。 |
返回值
注意
- (int)feedback:(ByteRTCProblemFeedbackOption)types info:(ByteRTCProblemFeedbackInfo* _Nullable)info;
objectivec通话结束,将用户反馈的问题上报到 RTC。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| types | ByteRTCProblemFeedbackOption | 预设问题列表,参看 ByteRTCProblemFeedbackOption |
| info | ByteRTCProblemFeedbackInfo* | 预设问题以外的其他问题的具体描述,房间信息。参看 ByteRTCProblemFeedbackInfo |
返回值
注意
- (void * _Nullable) getNativeHandle;
objectivecAvailable since 353
获取 C++ 层 IRTCVideo 句柄。
返回值
IRTCVideo 的地址。注意
在一些场景下,获取 C++ 层 IRTCVideo,并通过其完成操作,相较于通过 OC 封装层完成有显著更高的执行效率。典型的场景有:视频/音频帧自定义处理,音视频通话加密等。
- (int)setPublishFallbackOption:(ByteRTCPublishFallbackOption)option;
objectivec设置发布的音视频流的回退选项。
你可以调用该接口设置网络不佳或设备性能不足时从大流起进行降级处理,以保证通话质量。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| option | ByteRTCPublishFallbackOption | 本地发布的音视频流回退选项,参看 ByteRTCPublishFallbackOption。 |
返回值
注意
- (int)setSubscribeFallbackOption:(ByteRTCSubscribeFallbackOption)option;
objectivec设置订阅的音视频流的回退选项。
你可调用该接口设置网络不佳或设备性能不足时允许订阅流进行降级或只订阅音频流,以保证通话流畅。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| option | ByteRTCSubscribeFallbackOption | 订阅的音视频流回退选项,参看 ByteRTCSubscribeFallbackOption。 |
返回值
注意
- (int)setRemoteUserPriority:(ByteRTCRemoteUserPriority)priority InRoomId:(NSString *_Nonnull)roomId uid:(NSString *_Nonnull)uid;
objectivec设置用户优先级。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| priority | ByteRTCRemoteUserPriority | 远端用户的优先级, 详见枚举类型 ByteRTCRemoteUserPriority |
| roomId | NSString* | 房间 ID |
| uid | NSString* | 远端用户的 ID |
返回值
注意
- (int)setEncryptInfo:(ByteRTCEncryptType)encrypt_type key:(NSString * _Nonnull)key;
objectivec设置传输时使用内置加密的方式。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| encrypt_type | ByteRTCEncryptType | 内置加密算法,详见 ByteRTCEncryptType |
| key | NSString* | 加密密钥,长度限制为 36 位,超出部分将会被截断 |
返回值
注意
- (int)setCustomizeEncryptHandler:(id<ByteRTCEncryptHandler> _Nullable)handler;
objectivec设置自定义加密和解密方式。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| handler | id | 自定义加密 handler,需要实现里面的加密和解密方法。参看 ByteRTCEncryptHandler。 |
返回值
注意
- ( ByteRTCRoom * _Nullable)createRTCRoom:(NSString * _Nonnull)roomId;
objectivec创建房间实例。
调用此方法仅返回一个房间实例,你仍需调用 joinRoom:userInfo:roomConfig: 才能真正地创建/加入房间。
多次调用此方法以创建多个 ByteRTCRoom 实例。分别调用各 ByteRTCRoom 实例中的 joinRoom:userInfo:roomConfig: 方法,同时加入多个房间。
多房间模式下,用户可以同时订阅各房间的音视频流。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| roomId | NSString* | 标识通话房间的房间 ID。该字符串符合正则表达式:[a-zA-Z0-9_@\-\.]{1,128}。 |
返回值
创建的 ByteRTCRoom 房间实例。
注意
- (int)pushScreenVideoFrame:(CVPixelBufferRef _Nonnull )frame time:(CMTime)pts rotation:(int)rotation;
objectivec推送外部屏幕采集帧
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| frame | CVPixelBufferRef | 该视频帧包含待 SDK 编码的视频数据 支持的视频像素格式:NV12、BGRA、ARGB |
| pts | CMTime | 每一帧的时间戳,单位 ms |
| rotation | int | 帧的旋转角度包含: 0, 90, 180, 270 |
返回值
方法调用结果:
注意
屏幕采集分为内部采集和外部采集,本方法属于外部采集。
- (int)setRuntimeParameters:(NSDictionary * _Nullable)parameters;
objectivec设置运行时的参数
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| parameters | NSDictionary* | 保留参数 |
返回值
注意
该接口需在 joinRoom:userInfo:roomConfig: 和 startAudioCapture 之前调用。
- (NSArray<ByteRTCScreenCaptureSourceInfo *> *_Nonnull)getScreenCaptureSourceList;
objectivec获取共享对象(应用窗口和桌面)列表。
返回值
共享对象(应用窗口和桌面)列表。参看 ByteRTCScreenCaptureSourceInfo。
枚举值可作为调用 startScreenVideoCapture:captureParameters: 开启屏幕共享时的输入参数。
注意
仅桌面端可用。
- (int)startScreenVideoCapture:(ByteRTCScreenCaptureSourceInfo *_Nonnull)sourceInfo captureParameters:(ByteRTCScreenCaptureParam *_Nonnull)captureParameters;
objectivec采集屏幕视频流,用于共享。屏幕视频流包括:屏幕上显示的内容,或应用窗口中显示的内容。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| sourceInfo | ByteRTCScreenCaptureSourceInfo* | 待共享的屏幕源,参看 ByteRTCScreenCaptureSourceInfo。 你可以调用 getScreenCaptureSourceList 获得所有可以共享的屏幕源。 |
| captureParameters | ByteRTCScreenCaptureParam* | 共享参数。参看 ByteRTCScreenCaptureParam。 |
返回值
注意
- (int)stopScreenVideoCapture;
objectivec停止屏幕视频流采集。
返回值
注意
- (int)updateScreenCaptureRegion:(CGRect)regionRect;
objectivec内部屏幕流采集时,更新采集区域。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| regionRect | CGRect | 采集区域相对 startScreenVideoCapture:captureParameters: 中设定区域的值。 |
返回值
注意
调用此接口前,必须先通过调用 startScreenVideoCapture:captureParameters: 开启了内部屏幕流采集。
- (int)updateScreenCaptureHighlightConfig:(ByteRTCHighlightConfig *_Nonnull)config;
objectivec内部屏幕流采集时,更新边框高亮设置。默认展示边框。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| config | ByteRTCHighlightConfig* | 边框高亮设置。参见 ByteRTCHighlightConfig。 |
返回值
注意
调用此接口前,必须已通过调用 startScreenVideoCapture:captureParameters: 开启了内部屏幕流采集。
- (int)updateScreenCaptureMouseCursor:(ByteRTCMouseCursorCaptureState)mouseCursorCaptureState;
objectivec内部屏幕流采集时,更新对鼠标的处理设置。默认采集鼠标。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mouseCursorCaptureState | ByteRTCMouseCursorCaptureState | 参看 ByteRTCMouseCursorCaptureState。 |
返回值
注意
调用此接口前,必须已通过调用 startScreenVideoCapture:captureParameters: 开启了内部屏幕流采集。
- (int)updateScreenCaptureFilterConfig:(NSArray<NSNumber *> * _Nullable) excludedWindowList;
objectivec通过 RTC SDK 提供的采集模块采集屏幕视频流时,设置需要过滤的窗口。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| excludedWindowList | NSArray<NSNumber>** | 过滤掉的窗口列表。 |
返回值
注意
- (ByteRTCImage *_Nonnull)getThumbnail:(ByteRTCScreenCaptureSourceType)sourceType sourceId:(intptr_t)sourceId maxWidth:(int)maxWidth maxHeight:(int)maxHeight;
objectivec获取屏幕采集对象缩略图
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| sourceType | ByteRTCScreenCaptureSourceType | 屏幕采集对象的类型。详见 ByteRTCScreenCaptureSourceType。 |
| sourceId | intptr_t | 屏幕分享时,共享对象的 ID。可通过 getScreenCaptureSourceList 返回的ByteRTCScreenCaptureSourceInfo共享对象列表中获取。 |
| maxWidth | int | 最大宽度。保持采集对象本身的宽高比不变,将缩略图缩放到指定范围内的最大宽高。如果给出的尺寸与共享对象比例不同,得到的缩略图会有黑边。 |
| maxHeight | int | 最大高度。参见 maxWidth 的说明。 |
返回值
屏幕采集对象缩略图。缩略图由屏幕共享对象等比缩放而来。缩略图的大小小于等于此接口设定的尺寸。
- (ByteRTCImage *_Nonnull)getWindowAppIcon:(intptr_t)sourceId width:(int)width height:(int)height;
objectivec获取应用窗体所属应用的图标。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| sourceId | intptr_t | 屏幕共享对象的 ID,可通过 getScreenCaptureSourceList 返回的ByteRTCScreenCaptureSourceInfo共享对象列表中获取。 |
| width | int | 最大宽度。返回的图标将是宽高相等的,输入的宽高不等时,取二者较小值。宽高范围为 [32,256],超出该范围将返回 nullptr,默认输出 100 x 100 的图像。 |
| height | int | 最大高度。参见 width 的说明。 |
返回值
应用图标。当屏幕共享对象为应用窗体时有效,否则返回 nullptr。
- (ByteRTCAudioDeviceManager *_Null_unspecified)getAudioDeviceManager;
objectivec创建音频设备管理实例
- (ByteRTCVideoDeviceManager * _Null_unspecified)getVideoDeviceManager;
objectivec创建视频设备管理实例
返回值
视频设备管理实例,详见 ByteRTCVideoDeviceManager
- (int)startFileRecording:(ByteRTCStreamIndex)streamIndex withRecordingConfig:(ByteRTCRecordingConfig* _Nonnull)recordingConfig type:(ByteRTCRecordingType)recordingType;
objectivec该方法将通话过程中的音视频数据录制到本地的文件中。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 流属性,指定录制主流还是屏幕流,参看 ByteRTCStreamIndex |
| recordingConfig | ByteRTCRecordingConfig* | 本地录制参数配置,参看 ByteRTCRecordingConfig |
| recordingType | ByteRTCRecordingType | 本地录制的媒体类型,参看 ByteRTCRecordingType |
返回值
注意
- (int)stopFileRecording:(ByteRTCStreamIndex)streamIndex;
objectivec停止本地录制
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 流属性,指定停止主流或者屏幕流录制,参看 ByteRTCStreamIndex |
返回值
注意
- (int)startAudioRecording:(ByteRTCAudioRecordingConfig* _Nonnull) recordingConfig;
objectivec开启录制语音通话,生成本地文件。
在进房前后开启录制,如果未打开麦克风采集,录制任务正常进行,只是不会将数据写入生成的本地文件;只有调用 startAudioCapture 接口打开麦克风采集后,才会将录制数据写入本地文件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| recordingConfig | ByteRTCAudioRecordingConfig* | 参看 ByteRTCAudioRecordingConfig |
返回值
注意
- (int)stopAudioRecording;
objectivec停止音频文件录制
返回值
注意
调用 startAudioRecording: 开启本地录制。
- (ByteRTCAudioMixingManager *_Nullable)getAudioMixingManager __deprecated_msg("deprecated since 353.1, will be deleted in 359, use getAudioEffectPlayer and getMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use getAudioEffectPlayer or getMediaPlayer: instead
混音管理接口创建
返回值
混音管理实例,详见ByteRTCAudioMixingManager
- (ByteRTCAudioEffectPlayer *_Nullable)getAudioEffectPlayer;
objectivecAvailable since 3.53
创建音效播放器实例。
返回值
音效播放器。详见 ByteRTCAudioEffectPlayer。
- (ByteRTCMediaPlayer *_Nullable)getMediaPlayer:(int)playerId;
objectivecAvailable since 3.53
创建音乐播放器实例。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| playerId | int | 音乐播放器实例 id。取值范围为 [0, 3]。最多同时存在4个实例,超出取值范围时返回 nullptr。 |
返回值
音乐播放器实例,详见 ByteRTCMediaPlayer
- (int)login:(NSString * _Nonnull)token uid:(NSString * _Nonnull)uid;
objectivec登录 RTS 服务器。
必须先登录,才能调用 sendUserMessageOutsideRoom:message:config: 和 sendServerMessage: 发送房间外点对点消息和向应用服务器发送消息
在调用本接口登录后,如果想要登出,需要调用 logout
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| token | NSString* | 用户登录必须携带的 Token,用于鉴权验证。 测试时可使用控制台生成临时 Token, roomId 填任意值。正式上线需要使用密钥 SDK 在你的服务端生成并下发 Token, roomId 置空,Token 有效期及生成方式参看使用 Token 完成鉴权。 |
| uid | NSString* | 用户 ID,在 appid的维度下是唯一的。 |
返回值
注意
本地用户调用此方法登录后,会收到 rtcEngine:onLoginResult:errorCode:elapsed: 回调通知登录结果,远端用户不会收到通知。
- (int)logout;
objectivec登出 RTS 服务器。
调用本接口登出后,无法调用房间外消息以及端到服务器消息相关的方法或收到相关回调。
返回值
注意
- (int)updateLoginToken:(NSString * _Nonnull)token;
objectivec更新用户用于登录的 Token
Token 有一定的有效期,当 Token 过期时,需调用此方法更新登录的 Token 信息。
调用 login:uid: 方法登录时,如果使用了过期的 Token 将导致登录失败,并会收到 rtcEngine:onLoginResult:errorCode:elapsed: 回调通知,错误码为 ByteRTCLoginErrorCodeInvalidToken。此时需要重新获取 Token,并调用此方法更新 Token。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| token | NSString* | 更新的动态密钥 |
返回值
注意
- (int)setServerParams:(NSString * _Nonnull)signature url:(NSString * _Nonnull)url;
objectivec设置应用服务器参数
客户端调用 sendServerMessage: 或 sendServerBinaryMessage: 发送消息给应用服务器之前,必须需要设置有效签名和应用服务器地址。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| signature | NSString* | 动态签名,应用服务器可使用该签名验证消息来源。 签名需自行定义,可传入任意非空字符串,建议将 uid 等信息编码为签名。 设置的签名会以 post 形式发送至通过本方法中 url 参数设置的应用服务器地址。 |
| url | NSString* | 应用服务器的地址 |
返回值
注意
- (int)getPeerOnlineStatus:(NSString * _Nonnull)peerUserId;
objectivec查询对端用户或本端用户的登录状态
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| peerUserId | NSString* | 需要查询的用户 ID |
返回值
注意
- (NSInteger)sendUserMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSString * _Nonnull)messageStr config:(ByteRTCMessageConfig)config;
objectivec给房间外指定的用户发送文本消息(P2P)
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userId | NSString* | 消息接收用户的 ID |
| messageStr | NSString* | 发送的文本消息内容 消息不超过 64 KB。 |
| config | ByteRTCMessageConfig | 消息类型,参看 ByteRTCMessageConfig。 |
返回值
注意
- (NSInteger)sendUserBinaryMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSData * _Nonnull)messageStr config:(ByteRTCMessageConfig)config;
objectivec给房间外指定的用户发送二进制消息(P2P)
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userId | NSString* | 消息接收用户的 ID |
| messageStr | NSData* | 发送的二进制消息内容 消息不超过 46KB。 |
| config | ByteRTCMessageConfig | 消息类型,参看 ByteRTCMessageConfig。 |
返回值
注意
- (NSInteger)sendServerMessage:(NSString * _Nonnull)messageStr;
objectivec客户端给应用服务器发送文本消息(P2Server)
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| messageStr | NSString* | 发送的文本消息内容 消息不超过 64 KB。 |
返回值
注意
- (NSInteger)sendServerBinaryMessage:(NSData * _Nonnull)messageStr;
objectivec客户端给应用服务器发送二进制消息(P2Server)
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| messageStr | NSData* | 发送的二进制消息内容 消息不超过 46KB。 |
返回值
注意
- (int)startNetworkDetection:(bool)isTestUplink uplinkBandwidth:(int)expectedUplinkBitrate downlink:(bool)isTestDownlink downlinkBandwidth:(int)expectedDownlinkBitrate;
objectivec开始通话前网络探测
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| isTestUplink | bool | 是否探测上行带宽 |
| expectedUplinkBitrate | int | 期望上行带宽,单位:kbps范围为 {0, [100-10000]},其中, 0 表示由 SDK 指定最高码率。 |
| isTestDownlink | bool | 是否探测下行带宽 |
| expectedDownlinkBitrate | int | 期望下行带宽,单位:kbps范围为 {0, [100-10000]},其中, 0 表示由 SDK 指定最高码率。 |
返回值
注意
- (int)stopNetworkDetection;
objectivec停止通话前网络探测
返回值
注意
调用本接口后,会收到一次 rtcEngine:onNetworkDetectionStopped: 通知探测停止。
- (int)setScreenAudioSourceType:(ByteRTCAudioSourceType)sourceType;
objectivec在屏幕共享时,设置屏幕音频的采集方式(内部采集/自定义采集)
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| sourceType | ByteRTCAudioSourceType | 屏幕音频输入源类型, 参看 ByteRTCAudioSourceType。 |
返回值
注意
ByteRTCWarningSetScreenAudioSourceTypeFailed。- (int)setScreenAudioStreamIndex:(ByteRTCStreamIndex) index;
objectivec在屏幕共享时,设置屏幕音频流和麦克风采集到的音频流的混流方式
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| index | ByteRTCStreamIndex | 混流方式,参看 ByteRTCStreamIndex • ByteRTCStreamIndexMain: 将屏幕音频流和麦克风采集到的音频流混流 • ByteRTCStreamIndexScreen: 默认值,将屏幕音频流和麦克风采集到的音频流分为两路音频流 |
返回值
注意
你应该在 publishScreen: 之前,调用此方法。否则,你将收到 rtcEngine:onWarning: 的报错:ByteRTCWarningSetScreenAudioStreamIndexFailed
- (int) pushScreenAudioFrame:(ByteRTCAudioFrame* _Nonnull)audioFrame;
objectivec使用自定义采集方式,采集屏幕共享时的屏幕音频时,将音频帧推送至 RTC SDK 处进行编码等处理。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 音频数据帧,参见 ByteRTCAudioFrame • 音频采样格式为 S16。音频缓冲区内的数据格式必须为 PCM 数据,其容量大小应该为 samples × frame.channel × 2。 • 必须指定具体的采样率和声道数,不支持设置为自动。 |
返回值
方法调用结果
注意
- (int)startScreenAudioCapture:(NSString *_Nonnull)deviceId;
objectivec在屏幕共享时,开始使用 RTC SDK 内部采集方式,采集屏幕音频
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| deviceId | NSString* | 虚拟设备 ID |
返回值
注意
ByteRTCAudioSourceTypeExternal 自定义采集,需先切换为 ByteRTCAudioSourceTypeInternal 内部采集,否则该接口调用无效,并将触发 rtcEngine:onAudioDeviceWarning:deviceType:deviceWarning: 回调。- (int)stopScreenAudioCapture;
objectivec在屏幕共享时,停止使用 RTC SDK 内部采集方式,采集屏幕音频。
返回值
注意
- (int)setScreenAudioChannel:(ByteRTCAudioChannel) channel;
objectivec在屏幕共享时,设置屏幕音频流的声道数
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| channel | ByteRTCAudioChannel | 声道数,参看 ByteRTCAudioChannel |
返回值
注意
当你调用 setScreenAudioStreamIndex: 并设置屏幕音频流和麦克风音频流混流时,此接口不生效,音频通道数由 setAudioProfile: 控制。
- (int)setVideoSourceType:(ByteRTCVideoSourceType)type WithStreamIndex:(ByteRTCStreamIndex)streamIndex;
objectivec设置向 SDK 输入的视频源,包括屏幕流
默认使用内部采集。内部采集指:使用 RTC SDK 内置的视频采集机制进行视频采集。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCVideoSourceType | 视频输入源类型,参看 ByteRTCVideoSourceType |
| streamIndex | ByteRTCStreamIndex | 视频流的属性,参看 ByteRTCStreamIndex |
返回值
注意
- (int)setExternalVideoEncoderEventHandler:(id<ByteRTCExternalVideoEncoderEventHandler> _Nullable)handler;
objectivec注册自定义编码帧推送事件回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| handler | id | 自定义编码帧回调类,参看 ByteRTCExternalVideoEncoderEventHandler |
返回值
注意
- (int)pushExternalEncodedVideoFrame:(ByteRTCStreamIndex)streamIndex withVideoIndex:(NSInteger)videoIndex withEncodedVideoFrame:(ByteRTCEncodedVideoFrame* _Nonnull)videoFrame;
objectivec推送自定义编码后的视频流
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 需要推送的编码流的属性,参看 ByteRTCStreamIndex |
| videoIndex | NSInteger | 对应的编码流下标,从 0 开始,如果调用 setVideoEncoderConfig: 设置了多路流,此处数量须与之保持一致 |
| videoFrame | ByteRTCEncodedVideoFrame* | 编码流视频帧信息,参看 ByteRTCEncodedVideoFrame。 |
返回值
方法调用结果:
注意
- (int)setVideoDecoderConfig:(ByteRTCRemoteStreamKey * _Nonnull)key withVideoDecoderConfig:(ByteRTCVideoDecoderConfig)config;
objectivec在订阅远端视频流之前,设置远端视频数据解码方式
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| key | ByteRTCRemoteStreamKey* | 远端流信息,指定对哪一路视频流进行解码方式设置,参看 ByteRTCRemoteStreamKey。 |
| config | ByteRTCVideoDecoderConfig | 视频解码方式,参看 ByteRTCVideoDecoderConfig。 |
返回值
注意
key 中的 RoomId 和 UserId 为 nullptr,此时,通过此接口设置的解码方式根据 key 中的 StreamIndex 值,适用于所有的远端主流或屏幕流的解码方式。- (int)requestRemoteVideoKeyFrame:(ByteRTCRemoteStreamKey * _Nonnull)key;
objectivec在订阅远端视频流之后,向远端请求关键帧
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| key | ByteRTCRemoteStreamKey* | 远端流信息,参看 ByteRTCRemoteStreamKey。 |
返回值
注意
- (int)registerRemoteEncodedVideoFrameObserver:(id<ByteRTCRemoteEncodedVideoFrameObserver> _Nullable)observer;
objectivec注册远端编码后视频数据回调。
完成注册后,当 SDK 监测到远端编码后视频帧时,会触发 onRemoteEncodedVideoFrame:withEncodedVideoFrame: 回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| observer | id | 远端编码后视频数据监测器,参看 ByteRTCRemoteEncodedVideoFrameObserver |
返回值
注意
- (int)sendStreamSyncInfo:(NSData* _Nonnull)data config:(ByteRTCStreamSycnInfoConfig * _Nonnull)config;
objectivec发送音频流同步信息。将消息通过音频流发送到远端,并实现与音频流同步,该接口调用成功后,远端用户会收到 rtcEngine:onStreamSyncInfoReceived:streamType:data: 回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| data | NSData* | 消息内容。 |
| config | ByteRTCStreamSycnInfoConfig* | 媒体流信息同步的相关配置,详见 ByteRTCStreamSycnInfoConfig 。 |
返回值
注意
ByteRTCRoomProfileInteractivePodcast 房间模式下,此消息一定会送达。在其他房间模式下,如果本地用户未说话,此消息不一定会送达。- (int)muteAudioPlayback:(ByteRTCMuteState)muteState __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.45 and will be deleted in 3.51, use setPlaybackVolume: instead.
控制本地音频流播放状态:播放/不播放
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| muteState | ByteRTCMuteState | 播放状态,标识是否播放本地音频流,详见:ByteRTCMuteState |
返回值
注意
本方法仅控制本地收到音频流的播放状态,并不影响本地音频播放设备。
- (int)startEchoTest:(ByteRTCEchoTestConfig *_Nullable)echoConfig playDelay:(NSInteger)delayTime;
objectivec开启音视频回路测试。
在进房前,用户可调用该接口对音视频通话全链路进行检测,包括对音视频设备以及用户上下行网络的检测,从而帮助用户判断是否可以正常发布和接收音视频流。
开始检测后,SDK 会录制你声音或视频。如果你在设置的延时范围内收到了回放,则视为音视频回路测试正常。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| echoConfig | ByteRTCEchoTestConfig* | 回路测试参数设置,参看 ByteRTCEchoTestConfig。 |
| delayTime | NSInteger | 音视频延迟播放的时间间隔,用于指定在开始检测多长时间后期望收到回放。取值范围为 [2,10],单位为秒,默认为 2 秒。 |
返回值
方法调用结果:
注意
ByteRTCWarningCodeInEchoTestMode。- (int)stopEchoTest;
objectivec停止音视频回路测试。
调用 startEchoTest:playDelay: 开启音视频回路检测后,你必须调用该方法停止检测。
返回值
方法调用结果:
注意
音视频回路检测结束后,所有对系统设备及音视频流的控制均会恢复到开始检测前的状态。
- (int)setVideoWatermark:(ByteRTCStreamIndex)streamIndex withImagePath:(NSString * _Nullable)imagePath withRtcWatermarkConfig:(ByteRTCVideoWatermarkConfig* _Nonnull)rtcWatermarkConfig;
objectivec在指定视频流上添加水印。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 需要添加水印的视频流属性,参看 ByteRTCStreamIndex。 |
| imagePath | NSString* | 水印图片路径,仅支持本地文件绝对路径,长度限制为 512 字节。 水印图片为 PNG 或 JPG 格式。 |
| rtcWatermarkConfig | ByteRTCVideoWatermarkConfig* | 水印参数,参看 ByteRTCVideoWatermarkConfig。 |
返回值
注意
- (int)clearVideoWatermark:(ByteRTCStreamIndex)streamIndex;
objectivec移除指定视频流的水印。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 需要移除水印的视频流属性,参看 ByteRTCStreamIndex |
返回值
- (NSInteger)takeLocalSnapshot:(ByteRTCStreamIndex)streamIndex callback:(id<ByteRTCVideoSnapshotCallbackDelegate> _Nullable)callback;
objectivec截取本地视频画面
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamIndex | ByteRTCStreamIndex | 截图的视频流的属性,参看 ByteRTCStreamIndex。 |
| callback | id | 本地截图的回调。参看 ByteRTCVideoSnapshotCallbackDelegate。 |
返回值
本地截图任务的编号,从 1 开始递增。
注意
- (NSInteger)takeRemoteSnapshot:(ByteRTCRemoteStreamKey* _Nonnull)streamKey callback:(id<ByteRTCVideoSnapshotCallbackDelegate> _Nullable)callback;
objectivec截取远端视频画面
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamKey | ByteRTCRemoteStreamKey* | 截图的视频流,参看 ByteRTCRemoteStreamKey。 |
| callback | id | 参看 ByteRTCVideoSnapshotCallbackDelegate。 |
返回值
远端截图任务的编号,从 1 开始递增。
- (int)startCloudProxy:(NSArray <ByteRTCCloudProxyInfo *> * _Nullable)cloudProxiesInfo;
objectivec开启云代理
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| cloudProxiesInfo | NSArray <ByteRTCCloudProxyInfo>** | 云代理服务器信息列表。参看 ByteRTCCloudProxyInfo。 |
返回值
注意
- (int)stopCloudProxy;
objectivec关闭云代理
返回值
注意
要开启云代理,调用 startCloudProxy:
- (ByteRTCSingScoringManager *_Nullable)getSingScoringManager;
objectivec创建 K 歌评分管理接口。
返回值
K 歌评分管理接口,详见 ByteRTCSingScoringManager。
注意
如需使用 K 歌评分功能,即调用该方法以及 ISingScoringManager 类下全部方法,需集成 SAMI 动态库,详情参看按需集成插件文档。
- (ByteRTCNetworkTimeInfo *_Nonnull)getNetworkTimeInfo;
objectivec通过 NTP 协议,获取网络时间。
返回值
网络时间。参看 ByteRTCNetworkTimeInfo。
注意
0。同步完成后,会收到 rtcEngineOnNetworkTimeSynchronized:,此后,再次调用此 API,即可获取准确的网络时间。- (int)setAudioAlignmentProperty:(ByteRTCRemoteStreamKey * _Nonnull)streamKey withMode:(ByteRTCAudioAlignmentMode)mode;
objectivec在听众端,设置订阅的所有远端音频流精准对齐后播放。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| streamKey | ByteRTCRemoteStreamKey* | 作为对齐基准的远端音频流。参看 ByteRTCRemoteStreamKey。 一般选择主唱的音频流。 你必须在收到 rtcRoom:onUserPublishStream:type:,确认此音频流已发布后,调用此 API。 |
| mode | ByteRTCAudioAlignmentMode | 是否对齐,默认不对齐。参看 ByteRTCAudioAlignmentMode。 |
返回值
注意
ByteRTCRoomProfileChorus。syncProgressToRecordFrame 设置为 true。- (int)startHardwareEchoDetection:(NSString * _Nonnull)testAudioFilePath;
objectivec开启通话前回声检测
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| testAudioFilePath | NSString* | 用于回声检测的音频文件的绝对路径,路径字符串使用 UTF-8 编码格式,支持以下音频格式: mp3,aac,m4a,3gp,wav。 音频文件不为静音文件,推荐时长为 10 ~ 20 秒。 |
返回值
方法调用结果:
注意
ByteRTCRoomProfileMeeting 和 ByteRTCRoomProfileMeetingRoom 时支持开启本功能。- (int)stopHardwareEchoDetection;
objectivec停止通话前回声检测
返回值
方法调用结果:
注意
- (int)setLocalProxy:(NSArray <ByteRTCLocalProxyInfo *> * _Nonnull)configurations;
objectivec设置本地代理。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| configurations | NSArray <ByteRTCLocalProxyInfo>** | 本地代理配置参数。参看 ByteRTCLocalProxyInfo。 你可以根据自己的需要选择同时设置 Http 隧道 和 Socks5 两类代理,或者单独设置其中一类代理。如果你同时设置了 Http 隧道 和 Socks5 两类代理,此时,媒体和信令采用 Socks5 代理, Http 请求采用 Http 隧道代理;如果只设置 Http 隧道 或 Socks5 一类代理,媒体、信令和 Http 请求均采用已设置的代理。 调用此接口设置本地代理后,若想清空当前已有的代理设置,可再次调用此接口,选择不设置任何代理即可清空。 |
注意
@interface ByteRTCAudioDeviceManager : NSObject
objectivec音频设备管理类
- (ByteRTCDeviceCollection * _Nonnull)enumerateAudioPlaybackDevices;
objectivec获取当前系统内音频播放设备列表。
返回值
所有音频播放设备的列表,参看 ByteRTCDeviceCollection。
等待超时后会返回空列表。超时时间默认为 10 s。建议通过 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error: 监听到 ByteRTCMediaDeviceListUpdated 后,再次调用本接口获取。
注意
你可以在收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error: 了解设备变更后,重新调用本接口以获得新的设备列表。
- (ByteRTCDeviceCollection * _Nonnull)enumerateAudioCaptureDevices;
objectivec获取音频采集设备列表。
返回值
音频采集设备列表。详见 ByteRTCDeviceCollection。
等待超时后会返回空列表。超时时间默认为 10 s。建议通过 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error: 监听到 ByteRTCMediaDeviceListUpdated 后,再次调用本接口获取。
注意
你可以在收到 rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error: 了解设备变更后,重新调用本接口以获得新的设备列表。
- (void)followSystemCaptureDevice:(BOOL)followed;
objectivec设置音频采集路由是否跟随系统。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| followed | BOOL | • true: 跟随。此时,调用 setAudioCaptureDevice: 会失败。默认值。 • false: 不跟随系统。此时,可以调用 setAudioCaptureDevice: 进行设置。 |
- (void)followSystemPlaybackDevice:(BOOL)followed;
objectivec设置音频播放路由是否跟随系统。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| followed | BOOL | • true: 跟随。此时,调用 setAudioPlaybackDevice: 会失败。默认值。 • false: 不跟随系统。此时,可以调用 setAudioPlaybackDevice: 进行设置。 |
- (int)setAudioPlaybackDevice:(NSString * _Nonnull)deviceID;
objectivec设置音频播放设备。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| deviceID | NSString* | 音频播放设备 ID,可通过 enumerateAudioPlaybackDevices 获取。 |
返回值
注意
当你调用 followSystemPlaybackDevice: 设置音频播放设备跟随系统后,将无法调用此接口设置音频播放设备。
- (int)getAudioPlaybackDevice:(NSString * _Nonnull * _Nonnull) deviceID;
objectivec获取当前音频播放设备。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| deviceID | *NSString *** | 设备 ID |
返回值
方法调用结果
- (int)setAudioCaptureDevice:(NSString * _Nonnull)deviceID;
objectivec设置音频采集设备。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| deviceID | NSString* | 音频采集设备 ID。你可调用 enumerateAudioCaptureDevicesEnumerateAudioCaptureDevices 获取可用设备列表。 |
返回值
方法调用结果
注意
当你调用 followSystemCaptureDevice: 设置音频采集设备跟随系统后,将无法调用此接口设置音频采集设备。
- (int)getAudioCaptureDevice:(NSString *_Nonnull * _Nonnull) deviceID;
objectivec获取当前音频采集设备。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| deviceID | NSString** | 音频采集设备 ID。 |
返回值
方法调用结果
- (int) setAudioCaptureDeviceMute:(bool)mute;
objectivec设置当前音频采集设备静音状态,默认为非静音。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mute | bool | • true:静音 • false:非静音 |
返回值
方法调用结果
注意
true 静音后仍可通过 setAudioCaptureDeviceVolume 调整采集音量,调整后的音量会在取消静音后生效。- (int) getAudioCaptureDeviceMute:(bool * _Nonnull)mute;
objectivec获取当前音频采集设备是否静音的信息。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mute | bool* | • true:静音 • false:非静音 |
返回值
方法调用结果
- (int) setAudioPlaybackDeviceMute:(bool)mute;
objectivec设置当前音频播放设备静音状态,默认为非静音。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mute | bool | • true:静音 • false:非静音 |
返回值
方法调用结果
- (int) getAudioPlaybackDeviceMute:(bool * _Nonnull)mute;
objectivec获取当前音频播放设备是否静音的信息。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mute | bool* | • true:静音 • false:非静音 |
返回值
方法调用结果
- (int) setAudioCaptureDeviceVolume:(unsigned int)volume;
objectivec设置当前音频采集设备音量
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| volume | unsigned int | 音频采集设备音量,取值范围为 [0,255]。 • [0,25] 接近无声; • [25,75] 为低音量; • [76,204] 为中音量; • [205,255] 为高音量。 |
返回值
方法调用结果
注意
调用 setAudioCaptureDeviceMute 设为 true 静音采集设备后的音量调节会在取消静音后生效。
- (int) getAudioCaptureDeviceVolume:(unsigned int * _Nonnull)volume;
objectivec获取当前音频采集设备音量
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| volume | unsigned int* | 音频采集设备音量,取值范围是 [0,255] • [0,25] 接近无声; • [25,75] 为低音量; • [76,204] 为中音量; • [205,255] 为高音量。 |
返回值
方法调用结果
- (int) setAudioPlaybackDeviceVolume:(unsigned int)volume;
objectivec设置当前音频播放设备音量
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| volume | unsigned int | 音频播放设备音量,取值范围为 [0,255] • [0,25] 接近无声; • [25,75] 为低音量; • [76,204] 为中音量; • [205,255] 为高音量。 |
返回值
方法调用结果
- (int) getAudioPlaybackDeviceVolume:(unsigned int * _Nonnull)volume;
objectivec获取当前音频播放设备音量
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| volume | unsigned int* | 音频播放设备音量,取值范围是 [0,255] • [0,25] 接近无声; • [25,75] 为低音量; • [76,204] 为中音量; • [205,255] 为高音量。 |
返回值
方法调用结果
- (int)startAudioPlaybackDeviceTest:(NSString *_Nonnull)testAudioFilePath interval:(int)interval;
objectivec启动音频播放设备测试。
该方法测试播放设备是否能正常工作。SDK 播放指定的音频文件,测试者如果能听到声音,说明播放设备能正常工作。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| testAudioFilePath | NSString* | 音频文件的绝对路径,路径字符串使用 UTF-8 编码格式,支持以下音频格式: mp3,aac,m4a,3gp,wav。 |
| interval | int | 音频设备播放测试音量回调的间隔 |
返回值
方法调用结果
注意
- (int)stopAudioPlaybackDeviceTest;
objectivec停止音频播放设备测试。
返回值
方法调用结果
注意
调用 startAudioPlaybackDeviceTest:interval: 后,需调用本方法停止测试。
- (int)startAudioDeviceRecordTest:(int)interval;
objectivec开始音频采集设备和音频播放设备测试。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| interval | int | 测试中会收到 rtcEngine:onLocalAudioPropertiesReport: 回调,本参数指定了该周期回调的时间间隔,单位为毫秒。建议设置到大于 200 毫秒。最小不得少于 10 毫秒。 |
返回值
方法调用结果
注意
enableAudioPropertiesReport: 注册音量提示回调。- (int)stopAudioDeviceRecordAndPlayTest;
objectivec停止采集本地音频,并开始播放采集到的声音。录音播放完毕后,设备测试流程结束。
调用 startAudioDeviceRecordTest: 30s 内调用本接口来停止采集并开始播放此前采集到的声音。
返回值
方法调用结果
注意
- (int)stopAudioDevicePlayTest;
objectivec停止由调用 startAudioDeviceRecordTest: 开始的音频播放设备测试。
在音频播放设备测试自动结束前,可调用本接口停止音频采集与播放测试。
返回值
方法调用结果
注意
- (int)initAudioPlaybackDeviceForTest:(NSString * _Nonnull)deviceID;
objectivec尝试初始化音频播放设备,以检测设备不存在、权限被拒绝/禁用等异常问题。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| deviceID | NSString* | 设备索引号 |
返回值
设备状态错误码
注意
- (int)initAudioCaptureDeviceForTest:(NSString * _Nonnull)deviceID;
objectivec尝试初始化音频采集设备,以检测设备不存在、权限被拒绝/禁用等异常问题。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| deviceID | NSString* | 设备索引号 |
返回值
设备状态错误码
注意
- (void)setEnableSpeakerphone:(bool)enable;
objectivecDeprecated since 3.45 and will be deleted in 3.51.
切换音频播放到扬声器或者听筒,默认播放设备是扬声器
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | bool | • true:切换至扬声器 • false:切换至听筒 |
注意
本方法只在移动设备上有效
- (int)startAudioRecordingDeviceTest:(unsigned int)indicationInterval;
objectivec启动音频采集设备测试。
该方法测试音频采集设备是否能正常工作。启动测试后,会收到 rtcEngine:onLocalAudioPropertiesReport: 回调上报的音量信息。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| indicationInterval | unsigned int | 获取回调的时间间隔,单位为毫秒。建议设置到大于 200 毫秒。最小不得少于 10 毫秒。小于10 毫秒行为未定义。 |
返回值
方法调用结果
注意
- (int)stopAudioRecordingDeviceTest;
objectivec停止音频采集设备测试。
返回值
方法调用结果
注意
- (int)startAudioDeviceLoopbackTest:(unsigned int)indicationInterval;
objectivec开始音频设备回路测试。
该方法测试音频采集设备和音频播放设备是否能正常工作。一旦测试开始,音频采集设备会采集本地声音并通过音频播放设备播放出来,同时会收到 rtcEngine:onLocalAudioPropertiesReport:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| indicationInterval | unsigned int | 收到回调的时间间隔,单位为 ms。建议设置到大于 200 ms。最小不得少于 10 ms。 |
返回值
方法调用结果
注意
- (int)stopAudioDeviceLoopbackTest;
objectivec停止音频设备回路测试。
返回值
方法调用结果
注意
@interface ByteRTCAudioEffectPlayer :NSObject
objectivec音效播放器。
注意:
| 返回 | 名称 |
|---|---|
| int | start:filePath:config: |
| int | stop: |
| int | stopAll |
| int | preload:filePath: |
| int | unload: |
| int | unloadAll |
| int | pause: |
| int | pauseAll |
| int | resume: |
| int | resumeAll |
| int | setPosition:position: |
| int | getPosition: |
| int | setVolume:volume: |
| int | setVolumeAll: |
| int | getVolume: |
| int | getDuration: |
| int | setEventHandler: |
-(int)start:(int)effectId filePath:(NSString * _Nullable)filePath config:(ByteRTCAudioEffectPlayerConfig * _Nullable)config;
objectivec开始播放音效文件。
可以通过传入不同的 ID 和 filepath 多次调用本方法,以实现同时播放多个音效文件,实现音效叠加。
传入参数
| 参数名 | 类型 | 说明 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| effectId | int | 音效 ID。用于标识音效,请保证音效 ID 唯一性。 如果使用相同的 ID 重复调用本方法后,上一个音效会停止,下一个音效开始,并收到 onAudioEffectPlayerStateChanged:state:error:。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filePath | NSString* | 音效文件路径。 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。 推荐的音效文件采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。 不同平台支持的本地音效文件格式:
不同平台支持的在线音效文件格式:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config | ByteRTCAudioEffectPlayerConfig* | 音效配置,详见 ByteRTCAudioEffectPlayerConfig。 |
返回值
注意
preload 设置的 ID 相同。-(int)stop:(int)effectId;
objectivec停止播放音效文件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID |
返回值
注意
-(int)stopAll;
objectivec停止播放所有音效文件。
返回值
注意
-(int)preload:(int)effectId filePath:(NSString * _Nullable)filePath;
objectivec预加载指定音乐文件到内存中,以避免频繁播放同一文件时的重复加载,减少 CPU 占用。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID。用于标识音效,请保证音效 ID 唯一性。 如果使用相同的 ID 重复调用本方法,后一次会覆盖前一次。 如果先调用 start:filePath:config:,再使用相同的 ID 调用本方法 ,会收到回调 onAudioEffectPlayerStateChanged:state:error:,通知前一个音效停止,然后加载下一个音效。 调用本方法预加载 A.mp3 后,如果需要使用相同的 ID 调用 start:filePath:config: 播放 B.mp3,请先调用 unload: 卸载 A.mp3 ,否则会报错 AUDIO_MIXING_ERROR_LOAD_CONFLICT。 |
| filePath | NSString* | 音效文件路径。支持本地文件的 URI、或本地文件的绝对路径。 预加载的文件长度不得超过 20s。 不同平台支持的音效文件格式和 start:filePath:config: 一致。 |
返回值
注意
-(int)unload:(int)effectId;
objectivec卸载指定音效文件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID |
返回值
注意
调用本方法卸载该文件后,关于当前的混音状态,如果设置了 setEventHandler:,会收到回调 onAudioEffectPlayerStateChanged。
-(int)unloadAll;
objectivec卸载所有音效文件。
返回值
注意
调用本方法卸载该文件后,关于当前的混音状态,如果设置了 setEventHandler:,会收到回调 onAudioEffectPlayerStateChanged。
-(int)pause:(int)effectId;
objectivec暂停播放音效文件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID |
返回值
注意
-(int)pauseAll;
objectivec暂停播放所有音效文件。
返回值
注意
-(int)resume:(int)effectId;
objectivec恢复播放音效文件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID |
返回值
注意
调用 pause: 方法暂停播放音效文件后,可以通过调用本方法恢复播放。
-(int)resumeAll;
objectivec恢复播放所有音效文件。
返回值
注意
调用 pauseAll 方法暂停所有正在播放音效文件后,可以通过调用本方法恢复播放。
-(int)setPosition:(int)effectId position:(int)position;
objectivec设置音效文件的起始播放位置。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID |
| position | int | 音效文件起始播放位置,单位为毫秒。 你可以通过 getDuration: 获取音效文件总时长,position 的值应小于音效文件总时长。 |
返回值
注意
-(int)getPosition:(int)effectId;
objectivec获取音效文件播放进度。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID |
返回值
注意
-(int)setVolume:(int)effectId volume:(int)volume;
objectivec调节指定音效的音量大小,包括音效文件和 PCM 音频。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID |
| volume | int | 播放音量相对原音量的比值。单位为 %。范围为 [0, 400],建议范围是 [0, 100]。带溢出保护。 |
返回值
注意
仅在调用 start:filePath:config: 后调用此接口。
-(int)setVolumeAll:(int)volume;
objectivec设置所有音效的音量大小,包括音效文件和 PCM 音效。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| volume | int | 播放音量相对原音量的比值。单位为 %。范围为 [0, 400],建议范围是 [0, 100]。带溢出保护。 |
返回值
注意
该接口的优先级低于 setVolume:volume:,即通过 setVolume 单独设置了音量的音效 ID,不受该接口设置的影响。
-(int)getVolume:(int)effectId;
objectivec获取当前音量。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID |
返回值
注意
仅在调用 start:filePath:config: 后调用此接口。
-(int)getDuration:(int)effectId;
objectivec获取音效文件时长。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectId | int | 音效 ID |
返回值
注意
仅在调用 start:filePath:config: 后调用此接口。
-(int)setEventHandler:(_Nullable id<ByteRTCAudioEffectPlayerEventHandler>)handler;
objectivec设置回调句柄。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| handler | id | 参看 ByteRTCAudioEffectPlayerEventHandler。 |
返回值
@interface ByteRTCAudioMixingManager :NSObject
objectivec-(void)startAudioMixing:(int)mixId filePath:(NSString * _Nullable)filePath config:(ByteRTCAudioMixingConfig * _Nullable)config;
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead
开始播放音频文件。
可以通过传入不同的 mixId 和 filepath 多次调用本方法,以实现同时播放多个混音文件,实现混音叠加。
传入参数
| 参数名 | 类型 | 说明 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| mixId | int | 混音 ID。用于标识混音,请保证混音 ID 唯一性。 如果使用相同的 ID 重复调用本方法后,前一次混音会停止,后一次混音开始,SDK 会使用 onAudioMixingStateChanged 回调通知前一次混音已停止。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filePath | NSString* | 用于混音文件路径。 支持在线文件的 URL 和本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。 推荐的音频文件采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。 不同平台支持的本地音频文件格式:
不同平台支持的在线音频文件格式:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config | ByteRTCAudioMixingConfig* | 混音配置 可以设置混音的播放次数、是否本地播放混音、以及是否将混音发送至远端,详见 ByteRTCAudioMixingConfig |
注意
onAudioMixingStateChanged。- (void)stopAudioMixing:(int)mixId __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead
停止播放音频文件及混音。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
注意
onAudioMixingStateChanged。-(void)stopAllAudioMixing __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead");;
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead
停止播放所有音频文件及混音。
注意
onAudioMixingStateChanged 回调,通知已停止播放和混音。-(void)pauseAudioMixing:(int)mixId __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead
暂停播放音频文件及混音。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
注意
onAudioMixingStateChanged。-(void)pauseAllAudioMixing __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead
暂停播放所有音频文件及混音。
注意
onAudioMixingStateChanged 回调,通知已暂停播放和混音。-(void)resumeAudioMixing:(int)mixId __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead
恢复播放音频文件及混音。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
注意
onAudioMixingStateChanged。-(void)resumeAllAudioMixing __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead
恢复播放所有音频文件及混音。
注意
onAudioMixingStateChanged 回调,通知已恢复播放和混音。- (void)preloadAudioMixing:(int)mixId filePath:(NSString *_Nullable)filePath __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead
预加载指定音乐文件到内存中,以避免频繁播放同一文件时的重复加载,减少 CPU 占用。
传入参数
| 参数名 | 类型 | 说明 | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| mixId | int | 混音 ID。用于标识混音,请保证混音 ID 唯一性。 如果使用相同的 ID 重复调用本方法,后一次会覆盖前一次。 如果先调用 startAudioMixing:filePath:config:,再使用相同的 ID 调用本方法 ,会先回调 onAudioMixingStateChanged 通知上一个混音停止,然后加载后一个混音。 调用本方法预加载 A.mp3 后,如果需要使用相同的 ID 调用 startAudioMixing:filePath:config: 播放 B.mp3,请先调用 unloadAudioMixing: 卸载 A.mp3。 | ||||||||||||||||||||||||||||||||||||||||
| filePath | NSString* | 混音文件路径。仅支持本地文件的绝对路径。预加载的文件长度不得超过 20s。 不同平台支持的音频文件格式:
|
注意
onAudioMixingStateChanged。-(void)unloadAudioMixing:(int)mixId __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCAudioEffectPlayer instead
卸载指定音乐文件。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
注意
不论音频文件是否播放,调用本方法卸载该文件后,SDK 会回调通知混音已停止,见 onAudioMixingStateChanged。
- (void)setAudioMixingVolume:(int)mixId volume:(int)volume type:(ByteRTCAudioMixingType)type;
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead
调节指定混音的音量大小,包括音频文件混音和 PCM 混音。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 需调节音量的混音 ID |
| volume | int | 混音音量相对原音量的比值。范围为 [0, 400],建议范围是 [0, 100]。 • 0:静音 • 100:原始音量(默认值) • 400: 最大可调音量 (自带溢出保护) |
| type | ByteRTCAudioMixingType | 混音类型。是否本地播放、以及是否发送到远端,详见 ByteRTCAudioMixingType。 |
注意
该方法仅对指定混音 ID 生效。iOS 端提供 setAllAudioMixingVolume:type: 接口调节全部混音文件播放音量。
-(int)getAudioMixingDuration:(int)mixId __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead
获取音频文件时长。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
返回值
注意
调用本方法获取音频文件时长前,需要先调用 preloadAudioMixing:filePath: 或 startAudioMixing:filePath:config:。
-(int)getAudioMixingCurrentPosition:(int)mixId __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
获取音频文件播放进度。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
返回值
注意
调用本方法获取音频文件播放进度前,需要先调用 startAudioMixing:filePath:config: 开始播放音频文件。
- (void)setAudioMixingPosition:(int)mixId position:(int)position __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead
设置音频文件的起始播放位置
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
| position | int | 音频文件起始播放位置,单位为毫秒。 你可以通过 getAudioMixingDuration: 获取音频文件总时长,position 的值不得大于音频文件总时长。 |
注意
在播放在线文件时,调用此接口可能造成播放延迟的现象。
- (void)setAudioMixingDualMonoMode:(int)mixId mode:(ByteRTCAudioMixingDualMonoMode)mode;
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
设置当前音频文件的声道模式
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
| mode | ByteRTCAudioMixingDualMonoMode | 声道模式。默认的声道模式和源文件一致,详见 ByteRTCAudioMixingDualMonoMode。 |
注意
-(void)setAudioMixingPitch:(int)mixId pitch:(int)pitch __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer or ByteRTCAudioEffectPlayer instead
开启本地播放音乐文件变调功能,多用于 K 歌场景。
使用该方法,你可以对本地播放音乐文件的音调进行升调或降调等调整。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
| pitch | int | 相对于音乐文件原始音调的升高/降低值,取值范围[-12,12],默认值为 0,即不做调整。 取值范围内每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调,设置的绝对值越大表示音调升高或降低越多。 超出取值范围则设置失败,并且会触发 onAudioMixingStateChanged 回调,提示 ByteRTCAudioMixingState 状态为 AUDIO_MIXING_STATE_FAILED 混音播放失败,ByteRTCAudioMixingError 错误码为 AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH 设置混音文件音调不合法。 |
注意
本方法需要在调用 startAudioMixing:filePath:config: 开始播放音频文件后、调用 stopAudioMixing: 停止播放音频文件前使用,否则会触发 onAudioMixingStateChanged 回调报错
- (int)setAudioMixingPlaybackSpeed:(int)mixId speed:(int)speed __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
设置混音时音频文件的播放速度
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
| speed | int | 播放速度与原始文件速度的比例,单位:%,取值范围为 [50,200],默认值为 100。 超出取值范围则设置失败,你会收到 onAudioMixingStateChanged 回调,提示 ByteRTCAudioMixingState 状态为 ByteRTCAudioMixingStateFailed 混音播放失败,ByteRTCAudioMixingError 错误码为 ByteRTCAudioMixingErrorInValidPlaybackSpeed 设置混音文件的播放速度不合法。 |
注意
onAudioMixingStateChanged 回调提示 ByteRTCAudioMixingState 状态为 ByteRTCAudioMixingStatePlaying,ByteRTCAudioMixingError 错误码为 AUDIO_MIXING_ERROR_OK 之后调用该方法。ByteRTCAudioMixingStateFailed 错误码为 ByteRTCAudioMixingErrorIdNotFound 的 onAudioMixingStateChanged 回调。-(void)setAudioMixingLoudness:(int)mixId loudness:(float)loudness __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
如果你需要使用 enableVocalInstrumentBalance: 对混音音频文件/PCM 音频数据进行音量调整,你必须通过此接口传入其原始响度。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
| loudness | float | 原始响度,单位:lufs,取值范围为 [-70.0, 0.0]。 当设置的值小于 -70.0lufs 时,则默认调整为 -70.0lufs,大于 0.0lufs 时,则不对该响度做音均衡处理。默认值为 1.0lufs,即不做处理。 |
注意
建议在 startAudioMixing:filePath:config: 开始播放音频文件之前调用该接口,以免播放过程中的音量突变导致听感体验下降。
-(void) setAudioMixingProgressInterval:(int)mixId interval:(int64_t) interval __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
设置混音时音频文件播放进度回调的间隔
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID 可以通过多次调用本接口传入不同的 ID 对多个 ID 进行间隔设置。 |
| interval | int64_t | 音频文件播放进度回调的时间间隔,单位毫秒。 • interval 的值为大于 0 的 10 的倍数,当设置的值不能被 10 整除时,则默认向上取整 10,如设为 52ms 时会默认调整为 60ms。设置完成后 SDK 将会按照设置的时间间隔触发 onAudioMixingPlayingProgress 回调。 • interval 的值小于等于 0 时,不会触发进度回调。 |
注意
本方法需要在调用 startAudioMixing:filePath:config: 开始播放音频文件后、调用 stopAudioMixing: 停止播放音频文件前使用,否则会触发 onAudioMixingStateChanged 回调报错。 若想在音乐文件开始播放前设置播放进度回调间隔,你需调用 startAudioMixing:filePath:config: 在 ByteRTCAudioMixingConfig 中设置时间间隔,开始播放后可以通过此接口更新回调间隔。
-(void)enableAudioMixingFrame:(int)mixId type:(ByteRTCAudioMixingType)type __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
启动 PCM 音频数据混音。
要实现多个 PCM 音频数据混音,多次调用本方法,并传入不同的 id。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID。用于标识混音,保证混音 ID 唯一性。 如果使用相同的 ID 重复调用本方法后,前一次混音会停止,后一次混音开始,会收到 onAudioMixingStateChanged 通知前一次混音已停止。 |
| type | ByteRTCAudioMixingType | 混音类型。是否本地播放、以及是否发送到远端,详见 ByteRTCAudioMixingType。 |
注意
-(void)disableAudioMixingFrame:(int)mixId __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
关闭 PCM 混音
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID。 |
- (int)pushAudioMixingFrame:(int)mixId audioFrame:(ByteRTCAudioFrame *_Nullable)audioFrame __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
推送 PCM 音频帧数据用于混音
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID。 |
| audioFrame | ByteRTCAudioFrame* | 音频帧,详见 ByteRTCAudioFrame。 |
返回值
注意
-(int)getAudioTrackCount:(int)mixId __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
获取当前音频文件的音轨索引。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
返回值
方法调用结果
注意
-(void)selectAudioTrack:(int)mixId audioTrackIndex:(int)audioTrackIndex __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
指定当前音频文件的播放音轨。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mixId | int | 混音 ID |
| audioTrackIndex | int | 指定的播放音轨。 设置的参数值需要小于或等于 getAudioTrackCount: 的返回值 |
注意
- (void)registerAudioFileFrameObserver:(_Nullable id<ByteRTCAudioFileFrameObserver>) observer __deprecated_msg("deprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead");
objectivecDeprecated since 353.1, will be deleted in 359, use ByteRTCMediaPlayer instead
注册本地音频文件混音的音频帧观察者。
当本地音频文件混音时,会收到相关回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| observer | id | 参看 ByteRTCAudioFileFrameObserver。 |
@interface ByteRTCDeviceCollection : NSObject
objectivec音视频设备相关的信息
| 返回 | 名称 |
|---|---|
| int | getCount |
| int | getDevice:DeviceName:DeviceID: |
- (int)getCount;
objectivec获取当前音视频设备数量
返回值
音视频设备数量
- (int)getDevice:(int)index DeviceName:(NSString * _Nonnull * _Nonnull)deviceName DeviceID:(NSString * _Nonnull * _Nonnull) deviceID;
objectivec根据索引号,获取设备信息
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| index | int | 设备索引号,从 0 开始,注意需小于 getCount 返回值。 |
| deviceName | *NSString *** | 设备名称 |
| deviceID | *NSString *** | 设备 ID |
返回值
@interface ByteRTCMediaPlayer :NSObject
objectivec音乐播放器
调用 setEventHandler: 设置回调句柄以获取相关回调。
- (int)open:(NSString *_Nullable)filePath config:(ByteRTCMediaPlayerConfig *_Nullable)config;
objectivec打开音乐文件。
一个播放器实例仅能够同时打开一个音乐文件。如果需要同时打开多个音乐文件,请创建多个音乐播放器实例。
要播放 PCM 格式的音频数据,参看 openWithCustomSource:config:。openWithCustomSource 和此 API 互斥。
传入参数
| 参数名 | 类型 | 说明 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| filePath | NSString* | 音乐文件路径。 支持在线文件的 URL、本地文件的 URI、或本地文件的绝对路径。对于在线文件的 URL,仅支持 https 协议。 推荐的采样率:8KHz、16KHz、22.05KHz、44.1KHz、48KHz。 不同平台支持的本地文件格式:
不同平台支持的在线文件格式:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config | ByteRTCMediaPlayerConfig* | 详见 ByteRTCMediaPlayerConfig。 |
返回值
- (int)start;
objectivec播放音乐。你仅需要在调用 open:config:,且未开启自动播放时,调用此方法。
返回值
注意
openWithCustomSource 和此 API 互斥。- (int)openWithCustomSource:(ByteRTCMediaPlayerCustomSource *_Nullable)source config:(ByteRTCMediaPlayerConfig *_Nullable)config;
objectivec启动音频裸数据混音。
要播放音乐文件,参看 open:config:。open 与此 API 互斥。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| source | ByteRTCMediaPlayerCustomSource* | 数据源,详见 ByteRTCMediaPlayerCustomSource |
| config | ByteRTCMediaPlayerConfig* | 详见 ByteRTCMediaPlayerConfig |
返回值
注意
- (int)stop;
objectivec调用 open:config:, start, 或 openWithCustomSource:config: 开始播放后,可以调用本方法停止。
返回值
- (int)pause;
objectivec调用 open:config:,或 start 开始播放音频文件后,调用本方法暂停播放。
返回值
注意
- (int)resume;
objectivec调用 pause 暂停音频播放后,调用本方法恢复播放。
返回值
注意
此接口仅支持音频文件,不支持 PCM 数据。
- (int)setVolume:(int)volume type:(ByteRTCAudioMixingType)type;
objectivec调节指定混音的音量大小,包括音乐文件混音和 PCM 混音。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| volume | int | 播放音量相对原音量的比值。单位为 %。范围为 [0, 400],建议范围是 [0, 100]。带溢出保护。 |
| type | ByteRTCAudioMixingType | 详见 ByteRTCAudioMixingType。 |
返回值
注意
仅在音频播放进行状态时,调用此方法。
- (int)getVolume:(ByteRTCAudioMixingType)type;
objectivec获取当前音量
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCAudioMixingType | 详见 ByteRTCAudioMixingType。 |
返回值
注意
仅在音频播放进行状态时,调用此方法。包括音乐文件混音和 PCM 混音。
- (int)getTotalDuration;
objectivec获取音乐文件时长。
返回值
注意
- (int)getPlaybackDuration;
objectivec获取混音音乐文件的实际播放时长,单位为毫秒。
返回值
注意
0 时,调用此方法。- (int)getPosition;
objectivec获取音乐文件播放进度。
返回值
注意
- (int)setAudioPitch:(int)pitch;
objectivec开启变调功能,多用于 K 歌场景。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| pitch | int | 与音乐文件原始音调相比的升高/降低值,取值范围为 [-12,12],默认值为 0。每相邻两个值的音高距离相差半音,正值表示升调,负值表示降调。 |
返回值
注意
- (int)setPosition:(int)position;
objectivec设置音乐文件的起始播放位置。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| position | int | 音乐文件起始播放位置,单位为毫秒。 你可以通过 getTotalDuration 获取音乐文件总时长,position 的值应小于音乐文件总时长。 |
返回值
注意
- (int)setAudioDualMonoMode:(ByteRTCAudioMixingDualMonoMode)mode;
objectivec设置当前音乐文件的声道模式
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mode | ByteRTCAudioMixingDualMonoMode | 声道模式。默认的声道模式和源文件一致,详见 ByteRTCAudioMixingDualMonoMode。 |
返回值
注意
- (int)getAudioTrackCount;
objectivec获取当前音乐文件的音轨数
返回值
注意
- (int)selectAudioTrack:(int)index;
objectivec指定当前音乐文件的播放音轨
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| index | int | 指定的播放音轨,从 0 开始,取值范围为 [0, getAudioTrackCount()-1]。设置的参数值需要小于 getAudioTrackCount 的返回值 |
返回值
注意
- (int)setPlaybackSpeed:(int)speed;
objectivec设置播放速度
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| speed | int | 播放速度与原始文件速度的比例,单位:%,取值范围为 [50,200],默认值为 100。 |
返回值
注意
- (int)setProgressInterval:(int64_t)interval;
objectivec设置音频文件混音时,收到 onMediaPlayerPlayingProgress:progress: 的间隔。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| interval | int64_t | 时间间隔,单位毫秒。 • interval > 0 时,触发回调。实际间隔为 10 的倍数。如果输入数值不能被 10 整除,将自动向上取整。例如传入 52,实际间隔为 60 ms。• interval <= 0 时,不会触发回调。 |
返回值
注意
- (int)setLoudness:(float)loudness;
objectivec如果你需要使用 enableVocalInstrumentBalance: 对音频文件/PCM 音频数据设置音量均衡,你必须通过此接口传入其原始响度。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| loudness | float | 原始响度,单位:lufs,取值范围为 [-70.0, 0.0]。当设置的值小于 -70.0lufs 时,则默认调整为 -70.0lufs,大于 0.0lufs 时,则不对该响度做音量均衡处理。默认值为 1.0lufs,即不做处理。 |
返回值
注意
- (int)registerAudioFrameObserver:(_Nullable id<ByteRTCMediaPlayerAudioFrameObserver>)observer;
objectivec注册回调句柄以在本地音乐文件混音时,收到相关回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| observer | id | 参看 ByteRTCMediaPlayerAudioFrameObserver。 |
返回值
注意
此接口仅支持音频文件,不支持 PCM 数据。
- (int)pushExternalAudioFrame:(ByteRTCAudioFrame *_Nullable)audioFrame;
objectivec推送用于混音的 PCM 音频帧数据
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| audioFrame | ByteRTCAudioFrame* | 音频帧,详见 ByteRTCAudioFrame。 • 音频采样格式必须为 S16。音频缓冲区内的数据格式必须为 PCM,其容量大小应该为 audioFrame.samples × audioFrame.channel × 2。 • 必须指定具体的采样率和声道数,不支持设置为自动。 |
返回值
注意
- (int)setEventHandler:(_Nullable id<ByteRTCMediaPlayerEventHandler>)handler;
objectivec设置回调句柄。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| handler | id | 参看 ByteRTCMediaPlayerEventHandler。 |
返回值
@interface ByteRTCRangeAudio :NSObject
objectivec范围语音接口实例
| 返回 | 名称 |
|---|---|
| void | enableRangeAudio: |
| int | updateReceiveRange: |
| int | updatePosition: |
| int | setAttenuationModel:coefficient: |
| void | setNoAttenuationFlags: |
- (void)enableRangeAudio:(BOOL)enable;
objectivec开启/关闭范围语音功能。
范围语音是指,在同一 RTC 房间中设定的音频接收距离范围内,本地用户收听到的远端用户音频音量会随着远端用户的靠近/远离而放大/衰减;若远端用户在房间内的位置超出设定范围,则本地用户无法接收其音频。音频接收范围设置参看 updateReceiveRange:。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | BOOL | 是否开启范围语音功能: • YES: 开启 • NO: 关闭(默认) |
注意
该方法进房前后都可调用,为保证进房后范围语音效果的平滑切换,你需在该方法前先调用 updatePosition: 设置自身位置坐标,然后开启该方法收听范围语音效果。
- (int)updateReceiveRange:(ByteRTCReceiveRange* _Nonnull) range;
objectivec更新本地用户的音频收听范围。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| range | ByteRTCReceiveRange* | 音频收听范围,参看 ByteRTCReceiveRange。 |
返回值
方法调用结果:
- (int)updatePosition:(ByteRTCPosition* _Nonnull) pos;
objectivec更新本地用户在房间内空间直角坐标系中的位置坐标。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| pos | ByteRTCPosition* | 三维坐标的值,默认为 [0, 0, 0],参看 ByteRTCPosition。 |
返回值
方法调用结果:
注意
调用该接口更新坐标后,你需调用 enableRangeAudio: 开启范围语音功能以收听范围语音效果。
- (int)setAttenuationModel:(ByteRTCAttenuationType) type coefficient:(float)coefficient;
objectivec设置范围语音的音量衰减模式。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | ByteRTCAttenuationType | 音量衰减模式。默认为线性衰减。详见 ByteRTCAttenuationType。 |
| coefficient | float | 指数衰减模式下的音量衰减系数,默认值为 1。范围 [0.1,100],推荐设置为 50。数值越大,音量的衰减速度越快。 |
返回值
调用是否成功
0:调用成功-1:调用失败。原因为在调用 enableRangeAudio: 开启范围语音前或进房前调用本接口注意
音量衰减范围通过 updateReceiveRange: 进行设置。
- (void) setNoAttenuationFlags:(NSArray <NSString *> *_Nonnull)flags;
objectivec添加标签组,用于标记相互之间通话不衰减的用户组。
在同一个 RTC 房间中,如果多个用户的标签组之间有交集,那么,他们之间互相通话时,通话不衰减。
比如,用户身处多个队伍,队伍成员间通话不衰减。那么,可以为每个队伍绑定专属标签,每个用户的标签组包含用户所属各个队伍的标签。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| flags | NSArray <NSString>** | 标签组。 |
@interface ByteRTCSingScoringManager :NSObject
objectivecK 歌评分管理接口。
| 返回 | 名称 |
|---|---|
| int | initSingScoring:singScoringToken:delegate: |
| int | setSingScoringConfig: |
| NSArray<ByteRTCStandardPitchInfo >** | getStandardPitchInfo: |
| int | startSingScoring:scoringInfoInterval: |
| int | stopSingScoring |
| int | getLastSentenceScore |
| int | getTotalScore |
| int | getAverageScore |
-(int)initSingScoring:(NSString * _Nullable)singScoringAppkey singScoringToken:(NSString * _Nullable)singScoringToken delegate:(id<ByteRTCSingScoringDelegate> _Nullable)delegate;
objectivec初始化 K 歌评分。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| singScoringAppkey | NSString* | K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 |
| singScoringToken | NSString* | K 歌评分密钥,用于鉴权验证 K 歌功能是否开通。 |
| delegate | id | K 歌评分事件回调类,详见 ByteRTCSingScoringDelegate。 |
返回值
注意
输入正确的鉴权信息才可以使用 K 歌评分相关的功能,鉴权方式为离线鉴权,根据包名(bundleID)绑定 Appkey 及 Token,K 歌评分密钥请联系技术支持人员申请。
-(int)setSingScoringConfig:(ByteRTCSingScoringConfig * _Nullable)config;
objectivec设置 K 歌评分参数。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| config | ByteRTCSingScoringConfig* | K 歌评分的各项参数,详见 ByteRTCSingScoringConfig。 |
返回值
-(NSArray<ByteRTCStandardPitchInfo* > * _Nullable)getStandardPitchInfo:(NSString* _Nullable)midiFilepath;
objectivec获取标准音高数据。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| midiFilepath | NSString* | 歌曲 midi 文件路径。 |
返回值
ByteRTCStandardPitchInfo 标准音高数据数组。
注意
-(int)startSingScoring:(int)position scoringInfoInterval:(int)scoringInfoInterval;
objectivec开始 K 歌评分。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| position | int | 开始评分时,音乐的播放进度,单位:ms。 |
| scoringInfoInterval | int | 实时回调的时间间隔,单位:ms;默认 50 ms。最低间隔为 20 ms。 |
返回值
注意
-(int)stopSingScoring;
objectivec停止 K 歌评分。
返回值
-(int)getLastSentenceScore;
objectivec获取上一句的演唱评分。调用 startSingScoring:scoringInfoInterval: 开始评分后可以调用该接口。
返回值
-(int)getTotalScore;
objectivec获取当前演唱总分。调用 startSingScoring:scoringInfoInterval: 开始评分后可以调用该接口。
返回值
-(int)getAverageScore;
objectivec获取当前演唱歌曲的平均分。
返回值
@interface ByteRTCSpatialAudio :NSObject
objectivec空间音频接口实例
- (void)enableSpatialAudio:(BOOL)enable;
objectivec开启/关闭空间音频功能。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | BOOL | 是否开启空间音频功能: • YES:开启 • NO:关闭(默认) |
注意
该方法仅开启空间音频功能,你须调用 updatePosition: 设置自身位置坐标后方可收听空间音频效果。空间音频相关 API 和调用时序详见空间音频。
-(int)updatePosition:(ByteRTCPosition* _Nonnull) pos;
objectivecDeprecated since 3.52, will be deleted in 3.58, use updateSelfPosition: instead
更新本地用户发声时,在房间内空间直角坐标系中的位置坐标。
如果未调用 updateListenerPosition: 设定收听位置,默认的收听位置和发声位置一致。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| pos | ByteRTCPosition* | 三维坐标的值,默认为 [0, 0, 0]。参看 ByteRTCPosition。 |
返回值
注意
调用该接口更新坐标前,你需调用 enableSpatialAudio: 开启空间音频功能。空间音频相关 API 和调用时序详见空间音频。
-(int)updateSelfOrientation:(ByteRTCHumanOrientation* _Nonnull) orientation;
objectivecDeprecated since 3.52, will be deleted in 3.58, use updateSelfPosition: instead
更新本地用户发声时,在空间音频坐标系下的朝向。
如果未调用 updateListenerOrientation: 设定收听朝向,默认的收听位朝向和发声朝向一致。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| orientation | ByteRTCHumanOrientation* | 参看 ByteRTCHumanOrientation。 |
返回值
方法调用结果:
注意
-(void)disableRemoteOrientation;
objectivec关闭本地用户朝向对本地用户发声效果的影响。
调用此接口后,房间内的其他用户收听本地发声时,声源都在收听者正面。
注意
-(int)updateListenerPosition:(ByteRTCPosition* _Nonnull) pos;
objectivecDeprecated since 3.52, will be deleted in 3.58, use updateRemotePosition:positionInfo: instead
更新在房间内收听音频时的位置。
通过此接口,你可以设定本地发声位置和收听位置不同。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| pos | ByteRTCPosition* | 空间直角坐标系下的坐标值。参看 ByteRTCPosition。 如果未调用此接口设定收听位置,那么默认值为通过 updatePosition: 设定的值。 |
返回值
注意
-(int)updateListenerOrientation:(ByteRTCHumanOrientation* _Nonnull)orientation;
objectivecDeprecated since 3.52, will be deleted in 3.58, use updateRemotePosition:positionInfo: instead
更新在房间内收听音频时的朝向。
通过此接口,你可以设定本地用户的发声朝向和收听朝向不同。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| orientation | ByteRTCHumanOrientation* | 自身朝向信息,参看 ByteRTCHumanOrientation。 如果未调用此接口设定收听朝向,那么默认值为通过 updateSelfOrientation: 设定的值。 |
返回值
方法调用结果:
注意
空间音频相关 API 和调用时序详见空间音频。
-(int)updateSelfPosition:(ByteRTCPositionInfo* _Nonnull)positionInfo;
objectivecAvailable since 3.52
设置本地用户在自建空间直角坐标系中的收听坐标和收听朝向,以实现本地用户预期的空间音频收听效果。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| positionInfo | ByteRTCPositionInfo* | 空间音频位置信息。参看 ByteRTCPositionInfo。 |
返回值
注意
-(int)updateRemotePosition:(NSString * _Nonnull)uid positionInfo:(ByteRTCPositionInfo* _Nonnull)positionInfo;
objectivecAvailable since 3.52
设置房间内某一远端用户在本地用户自建的空间音频坐标系中的发声位置和发声朝向,以实现本地用户预期的空间音频收听效果。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 用户 ID |
| positionInfo | ByteRTCPositionInfo* | 远端用户的空间音频位置信息。参看 ByteRTCPositionInfo。 |
返回值
注意
该方法需在创建房间后调用。
调用此接口在本地进行的设定对其他用户的空间音频收听效果不会产生任何影响。
-(int)removeRemotePosition:(NSString * _Nonnull)uid;
objectivecAvailable since 3.52
移除调用 updateRemotePosition:positionInfo: 为某一远端用户设置的空间音频效果。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| uid | NSString* | 远端用户 ID。 |
返回值
-(int)removeAllRemotePosition;
objectivecAvailable since 3.52
移除调用 updateRemotePosition:positionInfo: 为所有远端用户设置的空间音频效果。
返回值
@interface ByteRTCVideoDeviceManager : NSObject
objectivec主要用于枚举、设置视频采集设备
| 返回 | 名称 |
|---|---|
| ByteRTCDeviceCollection* | enumerateVideoCaptureDevices |
| int | getVideoCaptureDevice: |
| int | setVideoCaptureDevice: |
- (ByteRTCDeviceCollection * _Nonnull)enumerateVideoCaptureDevices;
objectivec获取视频采集设备列表。
返回值
包含系统中所有视频采集设备的列表,参看 ByteRTCDeviceCollection。
等待超时后会返回空列表。超时时间默认为 10 s。建议通过 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error: 监听到 ByteRTCMediaDeviceListUpdated 后,再次调用本接口获取。
注意
你可以在收到 rtcEngine:onVideoDeviceStateChanged:device_type:device_state:device_error: 了解设备变更后,重新调用本接口以获得新的设备列表。
- (int)getVideoCaptureDevice:(NSString * _Nonnull * _Nonnull) deviceID;
objectivec获取当前 SDK 正在使用的视频采集设备信息
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| deviceID | *NSString *** | 视频设备 ID |
返回值
- (int)setVideoCaptureDevice:(NSString* _Nonnull)deviceID;
objectivec设置当前视频采集设备
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| deviceID | NSString* | 视频设备 ID。调用 enumerateVideoCaptureDevices 获取全量视频设备。 |
返回值
@interface ByteRTCVideoEffect : NSObject
objectivec高级视频特效,参看集成指南。
- (int)getAuthMessage:(NSString *_Nullable*_Nullable)ppmsg;
objectivec从特效 SDK 获取授权消息,用于获取在线许可证。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| ppmsg | NSString** | 授权消息字符串地址 |
返回值
注意
- (int) initCVResource:(NSString* _Nonnull)licenseFile withAlgoModelDir: (NSString* _Nonnull)algoModelDir;
objectivec检查视频特效证书,设置算法模型路径,并初始化特效模块。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| licenseFile | NSString* | 证书文件的绝对路径,用于鉴权。 |
| algoModelDir | NSString* | 算法模型绝对路径,即存放特效 SDK 所有算法模型的目录。 |
返回值
- (int) enableVideoEffect;
objectivec开启高级美颜、滤镜等视频特效。
返回值
注意
- (int) disableVideoEffect;
objectivec关闭视频特效。
返回值
注意
调用 enableVideoEffect 开启视频特效。
- (int) setEffectNodes:(NSArray<NSString*>*_Nonnull)effectNodes;
objectivec设置视频特效素材包。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| effectNodes | NSArray<NSString>** | 特效素材包绝对路径数组。 要取消当前视频特效,将此参数设置为 null。 |
返回值
注意
调用本方法前,必须先调用 enableVideoEffect。
- (int) updateEffectNode:(NSString* _Nonnull)node key:(NSString* _Nonnull)key value:(float) value;
objectivec设置特效强度。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| node | NSString* | 特效素材包绝对路径,参考素材包结构说明。 |
| key | NSString* | 需要设置的素材 key 名称,参考素材 key 对应说明。 |
| value | float | 特效强度值,取值范围 [0,1],超出范围时设置无效。 |
返回值
- (int) setColorFilter:(NSString* _Nonnull)filterRes;
objectivec设置颜色滤镜。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| filterRes | NSString* | 滤镜资源包绝对路径。 |
返回值
注意
调用 setColorFilterIntensity: 设置已启用颜色滤镜的强度。设置强度为 0 时即关闭颜色滤镜。
- (int) setColorFilterIntensity:(float) intensity;
objectivec设置已启用颜色滤镜的强度。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| intensity | float | 滤镜强度。取值范围 [0,1],超出范围时设置无效。 当设置滤镜强度为 0 时即关闭颜色滤镜。 |
返回值
- (int) enableVirtualBackground:(NSString* _Nonnull)backgroundStickerPath withSource:(ByteRTCVirtualBackgroundSource* _Nonnull)source;
objectivec将摄像头采集画面中的人像背景替换为指定图片或纯色背景。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| backgroundStickerPath | NSString* | 背景贴纸特效素材绝对路径。 |
| source | ByteRTCVirtualBackgroundSource* | 背景贴纸对象,参看 ByteRTCVirtualBackgroundSource。 |
返回值
注意
- (int) disableVirtualBackground;
objectivec关闭虚拟背景。
返回值
注意
调用 enableVirtualBackground:withSource: 开启虚拟背景后,可以调用此接口关闭虚拟背景。
- (int) registerFaceDetectionObserver:(_Nullable id<ByteRTCFaceDetectionObserver>) observer withInterval:(NSInteger)interval __deprecated_msg("Will be removed in new version");
objectivecDeprecated since 3.50 and will be deleted in 3.55, use enableFaceDetection:withInterval:withModelPath: and disableFaceDetection instead.
注册人脸检测结果回调观察者。
注册此观察者后,你会周期性收到 onFaceDetectResult: 回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| observer | id | 人脸检测结果回调观察者,参看 ByteRTCFaceDetectionObserver。 |
| interval | NSInteger | 时间间隔,必须大于 0。单位:ms。实际收到回调的时间间隔大于 interval,小于 interval+视频采集帧间隔。 |
返回值
- (int) enableFaceDetection:(_Nullable id<ByteRTCFaceDetectionObserver>) observer withInterval:(NSUInteger)interval withModelPath:(NSString* _Nonnull)path;
objectivec开启人脸识别功能,并设置人脸检测结果回调观察者。
此观察者后,你会周期性收到 onFaceDetectResult: 回调。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| observer | id | 人脸检测结果回调观察者,参看 ByteRTCFaceDetectionObserver。 |
| interval | NSUInteger | 两次回调之间的最小时间间隔,必须大于 0,单位为毫秒。实际收到回调的时间间隔大于 interval,小于 interval+视频采集帧间隔。 |
| path | NSString* | 人脸检测算法模型文件路径,一般为 ttfacemodel 文件夹中 tt_face_vXXX.model 文件的绝对路径。 |
返回值
- (int) disableFaceDetection;
objectivec关闭人脸识别功能。
返回值