类 | |
category | AliRtcEngine(Plugin) |
class | AliRtcEngine |
AliRTC功能的插件扩展
category AliRtcEngine(Plugin) |
构造函数 | |
(int) | - enablePlugin:pluginName:pluginType:opType:option: |
(int) | - removePlugin: |
(int) | - setPluginOption:opType:option: |
(int) | - getPluginOption:opType:option: |
(int) | - enablePlugin:pluginName:pluginType:opType:option: |
(int) | - removePlugin: |
(int) | - setPluginOption:opType:option: |
(int) | - getPluginOption:opType:option: |
- (int) enablePlugin: | (NSString *_Nullable) | moduleName | |
pluginName: | (NSString *_Nullable) | pluginName | |
pluginType: | (int) | pluginType | |
opType: | (uint32_t) | opType | |
option: | (const void *_Nullable) | option | |
开启音视频处理算法插件
RTC采用插件件形式提供音视频增强及特效能力,可通过官网组件文档 进行组件下载,参考插件集成文档集成进RTC引擎;
moduleName | 插件库包名,组件文档中会有对应描述,包名中不包含插件后缀名如:iOS/Mac平台使用虚拟背景插件bokeh.framework,则包名为bokeh,Windows平台插件库名为:bokeh.dll,则moduleName 为bokeh; |
pluginName | 插件类名,根据下载的插件库中头文件中描述进行设置 如:虚拟背景插件头文件中描述了 pluginName 为 PluginBokeh; |
pluginType | 插件类型,值为AliRtcPluginDataType 与AliRtcPluginOperationType组合, 如:视频前处理插件 pluginType = (AliRtcPluginDataTypeVideo << 16)|AliRtcPluginPreOperation; 如果需要修改已开启插件的pluginType,需要先进行插件关闭,再次开启; |
opType | 插件初始化参数类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 插件初始化参数值,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
AliRtcPluginErrorCode
;扩展类 AliRtcEngine.
- (int) removePlugin: | (uint32_t) | pluginId |
关闭音视频处理算法插件
pluginId | 开启音视频处理算法插件接口调用成功后返回值; |
AliRtcPluginErrorCode
;扩展类 AliRtcEngine.
- (int) setPluginOption: | (uint32_t) | pluginId | |
opType: | (uint32_t) | opType | |
option: | (const void *_Nullable) | option | |
根据插件ID设置插件
pluginId | 插件开启接口调用成功后返回值; |
opType | 设置插件参数类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 设置插件参数值,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
AliRtcPluginErrorCode
;扩展类 AliRtcEngine.
- (int) getPluginOption: | (uint32_t) | pluginId | |
opType: | (uint32_t) | opType | |
option: | (void *_Nonnull) | option | |
根据插件ID获取插件内部信息
pluginId | 开启插件接口调用成功后返回值; |
opType | 获取信息类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 返回的信息写入地址,插件会根据opType类型将返回的信息重写入option,需要进行内存初始化,长度请参考接入文档及插件头文件描述; |
AliRtcPluginErrorCode
;扩展类 AliRtcEngine.
- (int) enablePlugin: | (NSString *_Nullable) | moduleName | |
pluginName: | (NSString *_Nullable) | pluginName | |
pluginType: | (int) | pluginType | |
opType: | (uint32_t) | opType | |
option: | (const void *_Nullable) | option | |
开启音视频处理算法插件
RTC采用插件件形式提供音视频增强及特效能力,可通过官网组件文档 进行组件下载,参考插件集成文档集成进RTC引擎;
moduleName | 插件库包名,组件文档中会有对应描述,包名中不包含插件后缀名如:iOS/Mac平台使用虚拟背景插件bokeh.framework,则包名为bokeh,Windows平台插件库名为:bokeh.dll,则moduleName 为bokeh; |
pluginName | 插件类名,根据下载的插件库中头文件中描述进行设置 如:虚拟背景插件头文件中描述了 pluginName 为 PluginBokeh; |
pluginType | 插件类型,值为AliRtcPluginDataType 与AliRtcPluginOperationType组合, 如:视频前处理插件 pluginType = (AliRtcPluginDataTypeVideo << 16)|AliRtcPluginPreOperation; 如果需要修改已开启插件的pluginType,需要先进行插件关闭,再次开启; |
opType | 插件初始化参数类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 插件初始化参数值,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
AliRtcPluginErrorCode
;扩展类 AliRtcEngine.
- (int) removePlugin: | (uint32_t) | pluginId |
关闭音视频处理算法插件
pluginId | 开启音视频处理算法插件接口调用成功后返回值; |
AliRtcPluginErrorCode
;扩展类 AliRtcEngine.
- (int) setPluginOption: | (uint32_t) | pluginId | |
opType: | (uint32_t) | opType | |
option: | (const void *_Nullable) | option | |
根据插件ID设置插件
pluginId | 插件开启接口调用成功后返回值; |
opType | 设置插件参数类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 设置插件参数值,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
AliRtcPluginErrorCode
;扩展类 AliRtcEngine.
- (int) getPluginOption: | (uint32_t) | pluginId | |
opType: | (uint32_t) | opType | |
option: | (void *_Nonnull) | option | |
根据插件ID获取插件内部信息
pluginId | 开启插件接口调用成功后返回值; |
opType | 获取信息类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 返回的信息写入地址,插件会根据opType类型将返回的信息重写入option,需要进行内存初始化,长度请参考接入文档及插件头文件描述; |
AliRtcPluginErrorCode
;扩展类 AliRtcEngine.
class AliRtcEngine |
继承自 NSObject, <AliRtcEngineDelegate>, NSObject , 以及 <AliRtcEngineDelegate> .
+ (instancetype _Nonnull) sharedInstance: | (id< AliRtcEngineDelegate >_Nullable) | delegate | |
extras: | (NSString *_Nullable) | extras | |
获取一个AliRtcEngine实例
delegate | 用于接收AliRTC回调的代理。 |
extras | 用于接收来自客户灰度下发的参数,通过JSON配置SDK的特别功能,可以是空字符串。详情请参见官网有关extras功能说明。 |
该方法为同步调用,以单例的形式提供对象创建。
createChannelWithDelegate:extras:
+ (void) destroy |
销毁AliRtcEngine实例
调用该方法将会释放所有内部使用的资源,当完成音视频通信之后都建议调用该方法释放实例.调用该方法后,你将不能再使用 AliRtcEngine
的其他方法和任何回调,如需要再次使用需要重新调用 AliRtcEngine::sharedInstance:extras:
方法创建一个新的实例。
AliRtcEngine
实例,请开发者务必保证 destroy 方法执行结束后再创建实例。 + (NSString *_Nonnull) getSdkVersion |
查询SDK当前版本号
+ (int) setLogDirPath: | (NSString *_Nullable) | logDirPath |
设置SDK日志文件保存路径
logDirPath | 日志文件保存目录的绝对路径,该参数是一个目录路径,而不是文件的路径。 |
AliRtcErrLogRootPathError
: 路径已存在或因权限问题不可访问。AliRtcErrLogAlreadyInit
: log对象已经初始化过。+ (void) uploadLog |
上传日志文件
用户主动调用此接口,将当前日志目录下的所有未上传的日志文件进行压缩、打包、上传。
+ (NSString *_Nullable) getErrorDescription: | (NSInteger) | errCode |
- (int) enableDelegateMainQueue: | (BOOL) | enabled |
是否分发回调到主线程队列
设置是否分发回调到主线程队列,当enabled 为 NO 时,将分发至设置的回调队列,见 setDelegateQueue:
,如果未设置,则使用SDK内部默认子线程队列
enabled |
|
- (int) setDelegateQueue: | (NSOperationQueue *_Nullable) | queue |
指定回调线程队列
queue | 回调queue |
- (int) setAudioOnlyMode: | (BOOL) | audioOnly |
设置音频模式还是音视频模式
audioOnly |
|
joinChannel:name:onResultWithUserId:
之前设置 - (int) joinChannel: | (AliRtcAuthInfo *_Nonnull) | authInfo | |
name: | (NSString *_Nullable) | userName | |
onResult: | (void(^)(NSInteger errCode, NSString *_Nonnull channel, NSInteger elapsed)) | onResult | |
加入频道
authInfo | 认证信息,从App Server获取。 |
userName | 任意用于显示的用户名称。不是用户ID |
onResult | 当joinChannel执行结束后调用这个回调 |
- (int) joinChannel: | (AliRtcAuthInfo *_Nonnull) | authInfo | |
name: | (NSString *_Nullable) | userName | |
onResultWithUserId: | (void(^)(NSInteger errCode, NSString *_Nonnull channel, NSString *_Nonnull userId, NSInteger elapsed)) | onResult | |
加入频道
该方法让用户加入频道,一个频道内可以加入多个用户进行互相通话。
一般在调用该方法前会根据场景先选择频道模式,通过调用 setChannelProfile:
实现,默认频道模式为通信模式 AliRtcChannelProfile::AliRtcCommunication
authInfo | 认证信息,从App Server获取。 |
userName | 任意用于显示的用户名称。不是用户ID |
onResult | 当joinChannel执行结束后调用这个回调 |
onJoinChannelResult:channel:userId:elapsed:
onJoinChannelResult:channel:userId:elapsed:
判断,参数onResult也会回调onRemoteUserOnLineNotify:elapsed:
回调leaveChannel
离会,且确保 onLeaveChannelResult:stats:
回调收到后,再次调用进行入会switchChannel:
进行快速切换其他房间joinChannel:name:onResultWithUserId:
前调用 setDefaultSubscribeAllRemoteAudioStreams:
和 setDefaultSubscribeAllRemoteVideoStreams:
startChannelRelay:
实现跨频道通信,可以方便的实现两个不同直播间主播的互通联动 - (int) setParameter: | (NSString *_Nonnull) | param |
设置自定义参数
param | 自定义参数 |
- (int) leaveChannel |
离开频道
调用该方法代表离开频道,即挂断或者停止通话。
该方法为异步方法,调用后收到 onLeaveChannelResult:stats:
代表退出频道完成,同时会触发远端用户收到 onRemoteUserOffLineNotify:offlineReason:
回调。
如果未加入频道入会,leaveChannel
不会有任何影响。加入频道后,必须要调用该方法离开频道,否则无法加入其他频道。
onLeaveChannelResult:stats:
leaveChannel
后立刻调用 AliRtcEngine::destroy
方法,SDK将会无法触发 onLeaveChannelResult:stats:
回调 - (int) switchChannel: | (AliRtcAuthInfo *_Nonnull) | authInfo |
切换频道
当我们已经在一个频道中想要加入另外一个频道时,通常我们需要离会之后在收到离会回调之后再加入到另外一个频道中,调用方法可以实现快速切换频道。
成功调用该方切换频道后,本地会先收到离开原频道的回调 onLeaveChannelResult:stats:
,再收到成功加入新频道的回调 onJoinChannelResult:channel:userId:elapsed:
.
authInfo | 认证信息,从App Server获取。 |
AliRtcErrInner
:SDK未初始化或已销毁AliRtcErrSdkInvalidState
:当前未加入任何频道或者频道模式和角色不匹配,请确认频道为互动模式,用户角色为观众AliRtcErrInvalidArguments
:鉴权信息非法,请确认是否使用同一个authinfo多次加入同一个频道- (int) setChannelProfile: | (AliRtcChannelProfile) | profile |
设置频道模式
根据业务需求可以配置不同的频道模式,AliRTC会根据不用的频道模式模式采用不用的策略,目前主要提供通信模式(默认)、互动模式、低延迟互动直播模式
【通信模式 AliRtcCommunication】
【互动模式 AliRtcInteractivelive】
setClientRole:
进行设置。【低延迟互动直播模式 AliRtcInteractiveWithLowLatencyLive】
startLiveStreamingWithAuthInfo:onResult:
进行拉流profile | 频道模式类型, 详细请参考 AliRtcChannelProfile |
leaveChannel
后可以重新设置 - (int) setClientRole: | (AliRtcClientRole) | role |
设置互动模式下的用户角色
该方法在 ChannelProfile 设置为 AliRtcInteractivelive
时有效
该方法为异步方法,可以在入会前调用,也可以在入会后调用进行用户角色切换,默认角色为:观众角色
onRemoteUserOnLineNotify:elapsed:
回调publishLocalVideoStream:
和 publishLocalAudioStream:
onUpdateRoleNotifyWithOldRole:newRole:
回调:onRemoteUserOnLineNotify:elapsed:
回调publishLocalVideoStream:
和 publishLocalAudioStream:
onRemoteUserOffLineNotify:offlineReason:
回调role | 用户角色类型 AliRtcClientRole |
AliRtcInteractivelive
下调用有意义,入会前/会议中均可设置 onUpdateRoleNotifyWithOldRole:newRole:
回调后,才能再次调用有效 - (AliRtcClientRole) getCurrentClientRole |
- (int) refreshAuthInfo: | (AliRtcAuthInfo *_Nonnull) | authInfo |
刷新鉴权信息
该方法用于更新鉴权信息 AliRtcAuthInfo
,主要为了防止鉴权过期,导致推流失败,当我们收到 onAuthInfoWillExpire
回调时,应用应当更新鉴权信息
authInfo | 鉴权信息 |
- (int) setLocalViewConfig: | (AliVideoCanvas *_Nullable) | viewConfig | |
forTrack: | (AliRtcVideoTrack) | track | |
设置本地预览显示视图
viewConfig | 本地视频显示属性, 详细见 AliVideoCanvas |
track | 只支持 AliRtcVideoTrackCamera 和 AliRtcVideoTrackScreen |
AliVideoCanvas::view
为nil,则停止显示。 如果需要重新设置 AliVideoCanvas::renderMode
,请保持canvas中其他属性不变,仅修改 AliVideoCanvas::renderMode
。 如果需要重新设置 AliVideoCanvas::mirrorMode
,请保持canvas中其他属性不变,仅修改 AliVideoCanvas::mirrorMode
。 - (int) startPreview |
开启本地视频预览
setLocalViewConfig:forTrack:
设置显示的view,则无法预览。 可以在 joinChannel:name:onResultWithUserId:
之前就开启预览会自动打开摄像头。 - (int) stopPreview |
- (int) setCameraCapturerConfiguration: | (AliRtcCameraCapturerConfiguration *_Nonnull) | config |
设置camera采集偏好
config | 偏好设置
|
- (int) enableLocalVideo: | (BOOL) | enabled |
禁用或启用本地视频采集
enabled |
|
onUserVideoEnabled:videoEnabled:
获取用法是否禁用或启用本地视频采集状态。 - (int) muteLocalCamera: | (BOOL) | mute | |
forTrack: | (AliRtcVideoTrack) | track | |
是否将停止本地视频数据发送
mute | YES表示视频数据发送黑帧;NO表示恢复正常 |
track | 只支持 AliRtcVideoTrackCamera |
- (int) publishLocalVideoStream: | (BOOL) | enabled |
是否推送本地视频流
enabled | 是否开启/关闭本地视频流推流
|
AliRtcInteractivelive
模式,只有用户角色为 AliRtcClientRoleInteractive
时SDK才会允许允许推送视频流,因此该模式下调用此接口设置推流时,需要同时配合调用接口 AliRtcEngine::setClientRole:
更改角色AliRtcEngine::setExternalVideoSource:useTexture:sourceType:renderMode:
使用外部视频输入替换摄像头采集AliRtcEngineDelegate::onVideoPublishStateChanged:newState:elapseSinceLastState:channel:
回调通知视频推流最新状态 - (void) setVideoEncoderConfiguration: | (AliRtcVideoEncoderConfiguration *_Nonnull) | config |
设置相机流视频编码属性
该方法用于设置相机流视频编码属性对应的视频参数,如分辨率、帧率、码率、视频方向等 所有设置的参数都有相应的范围限制,如果设置的参数不在有效范围内,SDK会自动调节
config | 预定义的编码属性,详见 AliRtcVideoEncoderConfiguration |
- (void) setScreenShareEncoderConfiguration: | (AliRtcScreenShareEncoderConfiguration *_Nonnull) | config |
设置屏幕流视频编码属性
该方法用于设置屏幕流视频编码属性对应的视频参数,如分辨率、帧率、码率、视频方向等 所有设置的参数都有相应的范围限制,如果设置的参数不在有效范围内,SDK会自动调节
config | 预定义的屏幕共享编码属性,详见 AliRtcScreenShareEncoderConfiguration |
- (int) muteLocalMic: | (BOOL) | mute |
停止/恢复本地音频数据发送
mute |
|
- (int) muteLocalMic: | (BOOL) | mute | |
mode: | (AliRtcMuteLocalAudioMode) | mode | |
停止/恢复本地音频数据发送
mute | YES表示静音本地音频,发送静音帧; NO表示取消静音; |
mode | 静音模式,静音模式分三种,详见 AliRtcMuteLocalAudioMode ,默认模式为静音本地麦克风采集音频和所有外部输入音频; |
- (int) publishLocalAudioStream: | (BOOL) | enabled |
是否推送音频流
enabled | 是否开启/关闭本地音频流推流
|
AliRtcInteractivelive
模式,只有用户角色为 AliRtcClientRoleInteractive
时SDK才会允许允许推送视频流,因此该模式下调用此接口设置推流时,需要同时配合调用接口 AliRtcEngine::setClientRole:
更改角色AliRtcEngine::setExternalAudioSource:withSampleRate:channelsPerFrame:
使用外部音频输入替换麦克风采集AliRtcEngineDelegate:onAudioPublishStateChanged:newState:elapseSinceLastState:channel:
回调通知音频推流最新状态 - (int) setRemoteViewConfig: | (AliVideoCanvas *_Nullable) | canvas | |
uid: | (NSString *_Nonnull) | uid | |
forTrack: | (AliRtcVideoTrack) | track | |
设置远端视频显示视图
canvas | 本地视频显示属性, 详细见 AliVideoCanvas |
uid | 用户ID,从App server分配的唯一标示符 |
track | 只支持 AliRtcVideoTrack#AliRtcVideoTrackCamera 和 AliRtcVideoTrack#AliRtcVideoTrackScreen |
AliVideoCanvas#view
为nil,则停止显示。 如果需要重新设置 AliVideoCanvas#renderMode
,请保持canvas中其他属性不变,仅修改 AliVideoCanvas#renderMode
。 如果需要重新设置 AliVideoCanvas#mirrorMode
,请保持canvas中其他属性不变,仅修改 AliVideoCanvas#mirrorMode
。 - (int) setRemoteAudioVolume: | (NSString *_Nonnull) | uid | |
volume: | (NSInteger) | volume | |
调节本地播放的指定远端用户音量
uid | 用户ID,从App server分配的唯一标示符 |
volume | 播放音量,取值范围[0,100] 0:静音;100:原始音量 |
- (int) muteRemoteAudioPlaying: | (NSString *_Nonnull) | uid | |
mute: | (BOOL) | mute | |
停止/恢复远端指定用户的音频流的播放
uid | 用户ID , 从App server分配的唯一标示符 |
mute | YES表示停止播放; NO表示恢复播放 |
- (int) muteAllRemoteAudioPlaying: | (BOOL) | mute |
停止/恢复远端的所有音频流的播放
mute | YES表示停止播放;NO表示恢复播放 |
- (int) muteAllRemoteVideoRendering: | (BOOL) | mute |
mute/unmute远端的所有视频track的渲染
mute | YES表示停止渲染;NO表示恢复渲染 |
- (BOOL) isLocalVideoStreamPublished |
查询是否设置推送视频流
AliRtcEngine::publishLocalVideoStream:
方法设置为不推送 - (BOOL) isLocalAudioStreamPublished |
查询是否设置推送音频流
AliRtcEngine::publishLocalAudioStream:
方法设置为不推送 - (int) publishLocalDualStream: | (BOOL) | enabled |
是否推送次要视频流
enabled | 是否开启/关闭次要视频流推送
|
AliRtcEngine::setRemoteVideoStreamType:type:
方法选择订阅高分辨率或低分辨率视频流AliRtcEngine::publishLocalVideoStream:
方法开启视频流推送AliRtcEngineDelegate::onDualStreamPublishStateChanged:newState:elapseSinceLastState:channel:
回调通知次要视流最新状态 - (BOOL) isDualStreamPublished |
查询是否设置推送次要流
AliRtcEngine::publishLocalDualStream:
方法设置为推送 - (int) startScreenShare |
启动屏幕分享
- (int) startScreenShare: | (NSString *_Nonnull) | appGroup | |
mode: | (AliRtcScreenShareMode) | mode | |
启动屏幕分享
appGroup | 插件和宿主app约定使用相同的appGroup @prarm mode 屏幕共享模式,详见 AliRtcScreenShareMode |
AliRtcAudioScenario::AliRtcSceneDefaultMode
或AliRtcAudioScenario::AliRtcSceneEducationMode
,避免采集到当前应用的播放音频 - (int) stopScreenShare |
停止屏幕分享
- (int) setAudioShareAppVolume: | (int) | volume |
设置共享App音频的音量大小
volume | 共享App音频音量大小, 取值范围[0, 100], 默认值:50 |
- (BOOL) isScreenSharePublished |
查询是否设置推送屏幕分享
AliRtcEngine::startScreenShare
方法开启屏幕共享推送 - (int) setRemoteVideoStreamType: | (NSString *_Nonnull) | uid | |
type: | (AliRtcVideoStreamType) | streamType | |
设置订阅相机流格式,大流或小流
uid | 用户ID,从App server分配的唯一标示符 |
streamType | 流类型
|
AliRtcErrInner
:publishLocalDualStream:
打开双流模式,接收端才可以选择订阅大流还是小流,否则订阅的只能是大流; - (int) setRemoteDefaultVideoStreamType: | (AliRtcVideoStreamType) | streamType |
设置默认订阅的相机流格式,大流或小流;如果不设置,则默认订阅大流;
streamType | 流类型
|
AliRtcErrInner
:- (int) subscribeAllRemoteAudioStreams: | (BOOL) | sub |
停止/恢复订阅所有远端音频流
sub | 是否订阅所有远端音频流
|
AliRtcErrInner
: SDK内部状态错误,需检查是否创建SDK实例成功setDefaultSubscribeAllRemoteAudioStreams:
和 subscribeRemoteAudioStream:sub:
都不会生效; - (int) subscribeAllRemoteVideoStreams: | (BOOL) | sub |
停止/恢复订阅所有远端视频流
sub | 是否订阅所有远端视频流
|
AliRtcErrInner
: SDK内部状态错误,需检查是否创建SDK实例成功setDefaultSubscribeAllRemoteVideoStreams:
和 subscribeRemoteVideoStream:track:sub:
都不会生效; - (int) subscribeRemoteAudioStream: | (NSString *_Nonnull) | uid | |
sub: | (BOOL) | sub | |
停止/恢复订阅特定远端用户的音频流
uid | 用户ID,从App server分配的唯一标示符 |
sub | 是否订阅远端用户的音频流
|
AliRtcErrInner
:subscribeAllRemoteAudioStreams:
停止订阅所有远端音频,则此接口调用无效;subscribeAllRemoteAudioStreams:
是全局控制,subscribeRemoteAudioStream 是单独控制。 - (int) subscribeRemoteVideoStream: | (NSString *_Nonnull) | uid | |
track: | (AliRtcVideoTrack) | track | |
sub: | (BOOL) | sub | |
停止/恢复订阅远端用户的视频流
uid | 用户ID,从App server分配的唯一标示符 |
track | 视频流类型
|
sub | 是否订阅远端用户的视频流
|
AliRtcErrInner
:subscribeAllRemoteVideoStreams:
停止订阅所有远端视频,则此接口调用无效;subscribeAllRemoteVideoStreams:
是全局控制,SubscribeRemoteVideoStream 是单独控制。 - (int) setDefaultSubscribeAllRemoteAudioStreams: | (BOOL) | sub |
设置是否默认订阅音频流
sub | 是否默认订阅音频流
|
AliRtcErrInner
: SDK内部状态错误,需检查是否创建SDK实例成功subscribeRemoteAudioStream:sub:
,对指定的用户进行订阅或取消订阅操作;subscribeAllRemoteAudioStreams:
这个总开关控制,假设 subscribeAllRemoteAudioStreams:
设置为NO,则订阅全部关闭,其他启动行为全部不生效; - (int) setDefaultSubscribeAllRemoteVideoStreams: | (BOOL) | sub |
设置是否默认订阅视频流
sub | 是否默认订阅视频流
|
AliRtcErrInner
: SDK内部状态错误,需检查是否创建SDK实例成功subscribeRemoteVideoStream:track:sub:
,对指定的用户进行订阅或取消订阅操作;subscribeAllRemoteVideoStreams:
这个总开关控制,假设 subscribeAllRemoteVideoStreams:
设置为NO,则订阅全部关闭,其他启动行为全部不生效; - (NSArray< NSString * > *_Nullable) getOnlineRemoteUsers |
获取远端在线用户列表
AliRtcInteractivelive
模式,只有设置角色为 AliRtcClientRoleInteractive
的用户为在线用户,本方法不返回角色为 AliRtcClientRoleLive
的用户 - (BOOL) isUserOnline: | (NSString *_Nonnull) | uid |
查询用户是否在线
uid | 用户ID,从App server分配的唯一标示符。不可为NULL |
- (AliRtcConnectionStatus) getCurrentConnectionStatus |
获取当前网络链接状态
AliRtcConnectionStatus
onConnectionStatusChange:reason:
回调通知 AliRtcConnectionStatusDisconnected
- (int) enableSpeakerphone: | (BOOL) | enable |
设置音频输出为听筒还是扬声器
enable |
|
- (BOOL) isEnableSpeakerphone |
获取当前音频输出为听筒还是扬声器
- (int) setRecordingVolume: | (NSInteger) | volume |
设置录音音量
volume | 录音音量,取值范围[0,400]
|
- (int) setPlayoutVolume: | (NSInteger) | volume |
设置播放音量
volume | 播放音量,取值范围[0,400]
|
- (int) setAudioProfile: | (AliRtcAudioProfile) | audio_profile | |
audio_scene: | (AliRtcAudioScenario) | audio_scene | |
设置音频profile
audio_profile | 音频采集/编码模式参数, 详见 AliRtcAudioProfile ; |
audio_scene | 音频场景模式参数,详见 AliRtcAudioScenario ; |
joinChannel:name:onResultWithUserId:
前设置有效; - (int) setAudioSessionOperationRestriction: | (AliRtcAudioSessionOperationRestriction) | restriction |
设置SDK对AVAudioSession的控制权限
restriction | 控制权限 |
- (int) setDeviceVolumeType: | (AliRtcDeviceVolumeType) | type |
设置SDK设备音量类型
type | 音量类型 |
- (int) switchCamera |
切换前后摄像头
- (AliRtcCameraDirection) getCurrentCameraDirection |
获取当前摄像头方向,默认前置摄像头
AliRtcCameraDirectionInvalid
- (int) setCameraZoom: | (float) | zoom |
设置摄像头缩放
zoom | 缩放级别,范围从 1 到 camera支持的最大 zoom值 |
- (int) setCameraFlash: | (BOOL) | flash |
设置摄像头闪光灯开关
flash | 是否打开闪光灯 |
- (BOOL) isCameraFocusPointSupported |
摄像头是否支持手动聚焦
- (BOOL) isCameraExposurePointSupported |
摄像头是否支持设置曝光点
- (int) setCameraFocusPoint: | (CGPoint) | point |
设置摄像头手动聚焦点
point | 聚焦点坐标 |
- (int) setCameraExposurePoint: | (CGPoint) | point |
设置摄像头曝光点
point | 曝光点 |
- (BOOL) isCameraAutoFocusFaceModeSupported |
摄像头是否支持人脸聚焦
- (BOOL) setCameraAutoFocusFaceModeEnabled: | (BOOL) | enable |
设置摄像头人脸对焦
enable | YES: 开启; NO:关闭 |
AliRtcEngine::isCameraAutoFocusFaceModeSupported
返回 YES 且此调用enable为 YES 的情况下,实时对焦到采集到数据的人脸上 - (void) startAudioCapture |
开启音频采集
此接口可以控制提前打开音频采集,如果不设置,则SDK会自动控制音频采集设备:
publishLocalAudioStream:
,SDK在入会后会打开音频采集publishLocalAudioStream:
,SDK在入会后不会打开音频采集- (void) startAudioCapture: | (BOOL) | keepAlive |
开启音频采集
此接口可以控制提前打开音频采集,如果不设置,则SDK会自动控制音频采集设备:
publishLocalAudioStream:
,SDK在入会后会打开音频采集publishLocalAudioStream:
,SDK在入会后不会打开音频采集keepAlive | YES: 离会后采集设备保持开启状态;NO: 离会后采集设备关闭 |
- (void) stopAudioCapture |
关闭音频采集
- (void) startAudioPlayer |
开启音频播放
- (void) stopAudioPlayer |
关闭音频播放
startAudioPlayer
对应 - (void) setLogLevel: | (AliRtcLogLevel) | logLevel |
设置日志等级
logLevel | Log级别,详见 AliRtcLogLevel 枚举类型 |
AliRtcLogLevel::AliRtcLogLevelInfo
- (BOOL) isCameraOn |
检查camera是否打开
- (BOOL) isInCall |
获取状态:当前是否在频道中
- (BOOL) isAudioOnly |
查询是否纯音频模式
- (NSDictionary *_Nullable) getUserInfo: | (NSString *_Nonnull) | uid |
查询远端用户状态
uid | 用户ID。从App server分配的唯一标示符 |
+ (void) setH5CompatibleMode: | (BOOL) | comp |
设置H5兼容模式
互动模式下,是否需要与Web SDK互通。如果使用Native SDK用户加入频道,需要与通过Web SDK加入频道的用户进行互通,则必须使用H5兼容模式,否则,Web用户查看Native用户将是黑屏。
comp |
|
+ (BOOL) getH5CompatibleMode |
检查当前是否兼容H5、与Web SDK互通
- (int) showDebugView: | (UITextView *_Nonnull) | view | |
showType: | (AliRtcShowDebugViewType) | showType | |
userId: | (NSString *_Nullable) | userId | |
展示用户Debug数据
view | 对外展示的View,由客户传入,显示样式由客户指定 |
showType | 展示类型:0: 不显示 1.音频 2.视频 3.全部;另外可以传入特殊的值来展示 |
userId | 对应用户ID |
- (void) setSubscribeAudioNumChannel: | (AliRtcAudioNumChannel) | audioNumChannel |
设置回调音频声道数,默认单声道 (混音前数据不支持该参数设置)
audioNumChannel | 声道数,必须是 AliRtcAudioNumChannel |
subscribeAudioData:
前进行设置 - (void) setSubscribeAudioSampleRate: | (AliRtcAudioSampleRate) | audioSampleRate |
设置回调音频采样率,默认44100(混音前数据不支持该参数设置)
audioSampleRate | 采样率,必须是 AliRtcAudioSampleRate |
subscribeAudioData:
前进行设置 - (void) subscribeAudioData: | (AliRtcAudioSource) | audioSource |
订阅音频数据
audioSource | 音频数据源类型,详见 AliRtcAudioSource |
setSubscribeAudioNumChannel:
与 setSubscribeAudioSampleRate:
设置输出音频数据参数 - (void) unSubscribeAudioData: | (AliRtcAudioSource) | audioSource |
取消订阅音频数据
audioSource | 音频数据源类型,详见 AliRtcAudioSource |
- (int) enableAudioVolumeIndication: | (NSInteger) | interval | |
smooth: | (NSInteger) | smooth | |
reportVad: | (NSInteger) | reportVad | |
设置音量回调频率和平滑系数
interval | 时间间隔,单位毫秒,最小值不得小于10ms, 建议设置300-500ms, <= 0表示不启用音量提示和说话人提示功能 |
smooth | 平滑系数,数值越大平滑程度越高,反之越低,实时性越好,建议设置3,范围[0, 9]; |
reportVad | 说话人检测开关
|
AliRtcEngineDelegate::onAudioVolumeCallback:totalVolume:
和 AliRtcEngineDelegate::onActiveSpeaker:
回调 - (BOOL) getVideoCaptureData: | (AliRtcVideoTrack) | videoTrack | |
videoSample: | (AliRtcVideoDataSample **) | p_sample | |
主动获取采集数据
videoTrack | 视频流类型 |
p_sample | 数据接收对象 |
onGetIfUserFetchObserverData
返回 YES 时有效 - (BOOL) getVideoPreEncoderData: | (AliRtcVideoTrack) | videoTrack | |
videoSample: | (AliRtcVideoDataSample **) | p_sample | |
主动获取编码前数据
videoTrack | 视频流类型 |
p_sample | 数据接收对象 |
onGetIfUserFetchObserverData
返回 YES 时有效 - (BOOL) getVideoRenderData: | (NSString *) | uid | |
videoTrack: | (AliRtcVideoTrack) | videoTrack | |
videoSample: | (AliRtcVideoDataSample **) | p_sample | |
主动获取拉流数据,onGetIfUserFetchObserverData 返回 YES 时有效
uid | 远端用户ID |
videoTrack | 视频流类型 |
p_sample | 数据接收对象 |
onGetIfUserFetchObserverData
返回 YES 时有效 - (void) registerLocalVideoTexture |
注册本地相机流视频OpenGL纹理数据观测器
- (int) setExternalVideoSource: | (BOOL) | enable | |
sourceType: | (AliRtcVideoSource) | type | |
renderMode: | (AliRtcRenderMode) | renderMode | |
启用外部视频输入源
enable |
|
type | 流类型,详见 AliRtcVideoSource
|
renderMode | 处理模式,外部输入视频源宽高比和推流profile不一致时,会按照对应的rendermode做对应处理,详见 AliRtcRenderMode
|
- (int) pushExternalVideoFrame: | (AliRtcVideoDataSample *_Nonnull) | frame | |
sourceType: | (AliRtcVideoSource) | type | |
输入视频数据
frame | 帧数据,详见 AliRtcVideoDataSample |
type | 流类型,详见 AliRtcVideoSource
|
- (int) setExternalAudioSource: | (BOOL) | enable | |
withSampleRate: | (NSUInteger) | sampleRate | |
channelsPerFrame: | (NSUInteger) | channelsPerFrame | |
设置是否启用外部音频输入源
enable | YES:开启; NO:关闭 |
sampleRate | 采样率 16k, 48k... |
channelsPerFrame | 声道数 1:单声道; 2:双声道 |
- (int) pushExternalAudioFrameRawData: | (void *_Nonnull) | data | |
samples: | (NSUInteger) | samples | |
timestamp: | (NSTimeInterval) | timestamp | |
输入外部音频数据推流到远端
data | 音频数据buffer |
samples | 音频数据buffer长度 |
timestamp | 时间戳 |
AliRtcErrorCode::AliRtcErrAudioBufferFull
时,需要在间隔投递数据时间长度后再次重试投递 AliRtcErrorCode::AliRtcErrAudioBufferFull
时,说明内部缓冲区已满,建议等待20ms后再重新送当前数据帧; - (int) setExternalAudioVolume: | (int) | vol |
设置外部音频音量
vol | 音量,取值范围[0,100] |
- (int) getExternalAudioVolume |
获取混音音量
- (int) setMixedWithMic: | (BOOL) | mixed |
设置是否与麦克风采集音频混合
mixed | YES:混音;NO:完全替换麦克风采集数据 |
- (int) setExteranlAudioRender: | (BOOL) | enable | |
sampleRate: | (NSUInteger) | sampleRate | |
channelsPerFrame: | (NSUInteger) | channelsPerFrame | |
设置是否启用外部输入音频播放
enable | YES:开启; NO:关闭 |
sampleRate | 采样率 16000 48000... |
channelsPerFrame | 声道数 1:单声道; 2:双声道 |
- (int) pushExternalAudioRenderRawData: | (const void *_Nullable) | audioSamples | |
sampleLength: | (NSUInteger) | sampleLength | |
sampleRate: | (NSUInteger) | sampleRate | |
channelsPerFrame: | (NSUInteger) | channelsPerFrame | |
timestamp: | (long long) | timestamp | |
输入外部音频数据本地播放
audioSamples | 音频数据buffer |
sampleLength | 音频数据buffer长度 |
sampleRate | 输入音频数据的采样率 |
channelsPerFrame | 输入音频数据的声道数 |
timestamp | 时间戳 |
AliRtcErrorCode::AliRtcErrAudioBufferFull
时,需要在间隔投递数据时间长度后再次重试投递 AliRtcErrorCode::AliRtcErrAudioBufferFull
时,说明内部缓冲区已满,建议等待20ms后再重新送当前数据帧; - (int) setAudioEffectPitchValue: | (double) | value |
设置变调参数
value | 变调参数,范围:[0.5, 2.0],1.0表示音调不变,小于1.0表示音调降低,大于1.0表示音调升高,默认1.0 |
- (int) setAudioEffectVoiceChangerMode: | (AliRtcAudioEffectVoiceChangerMode) | mode |
- (int) setAudioEffectReverbMode: | (AliRtcAudioEffectReverbMode) | mode |
- (int) setAudioEffectReverbParamType: | (AliRtcAudioEffectReverbParamType) | type | |
value: | (float) | value | |
设置混响音效类型
type | 参考 AliRtcAudioEffectReverbParamType 对应的混响类型 |
value | 混响参数值,不同混响类型的取值范围参考 AliRtcAudioEffectReverbParamType 中取值说明 |
setAudioEffectReverbMode:
之后调用 - (int) startAudioAccompanyWithFile: | (NSString *_Nonnull) | filePath | |
onlyLocalPlay: | (BOOL) | onlyLocalPlay | |
replaceMic: | (BOOL) | replaceMic | |
loopCycles: | (NSInteger) | loopCycles | |
开始伴奏混音
filePath | 伴奏文件路径 |
onlyLocalPlay | 是否只本地播放 |
replaceMic | 是否替换掉MIC |
loopCycles | 循环次数,可以设置-1(无限循环)或者>0的正整数次,其他值无效 |
onAudioPlayingStateChanged:errorCode:
监听播放器状态 - (int) stopAudioAccompany |
停止伴奏混音
- (int) setAudioAccompanyVolume: | (NSInteger) | volume |
设置伴奏音量
volume | 伴奏音量,取值范围[0,100] |
- (int) setAudioAccompanyPublishVolume: | (NSInteger) | volume |
设置伴奏推流音量
volume | 伴奏推流音量,取值范围[0,100] |
- (int) getAudioAccompanyPublishVolume |
获取伴奏推流音量
- (int) setAudioAccompanyPlayoutVolume: | (NSInteger) | volume |
设置伴奏本地播放音量
volume | 伴奏本地播放音量,取值范围[0,100] |
- (int) getAudioAccompanyPlayoutVolume |
获取伴奏本地播放音量
- (int) pauseAudioAccompany |
暂停伴奏混音
- (int) resumeAudioAccompany |
重新开始伴奏混音
- (int) getAudioAccompanyDuration |
获取伴奏文件时长, 单位为毫秒
- (int) getAudioAccompanyCurrentPosition |
获取伴奏文件播放进度,单位为毫秒
- (int) setAudioAccompanyPosition: | (int) | pos |
设置伴奏文件的播放位置
pos | 进度条位置,单位为毫秒 |
- (int) preloadAudioEffectWithSoundId: | (NSInteger) | soundId | |
filePath: | (NSString *_Nonnull) | filePath | |
预加载音效文件
soundId | 用户给该音效文件分配的ID |
filePath | 音效文件路径,支持本地文件和网络url |
- (int) unloadAudioEffectWithSoundId: | (NSInteger) | soundId |
删除预加载的音效文件
soundId | 用户给该音效文件分配的ID |
preloadAudioEffectWithSoundId:filePath:
时传入的ID相同 - (int) playAudioEffectWithSoundId: | (NSInteger) | soundId | |
filePath: | (NSString *_Nonnull) | filePath | |
cycles: | (NSInteger) | cycles | |
publish: | (BOOL) | publish | |
开始播放音效
开始播放音效接口,可以多次调用该方法传入不同的soundId和filePath,同时播放多个音效文件,音效文件播放结束后,SDK 会触发 onAudioEffectFinished:
回调
soundId | 用户给该音效文件分配的ID,每个音效均有唯一的ID,如果你已通过 preloadAudioEffectWithSoundId:filePath: 将音效加载至内存,确保这里的soundId与 preloadAudioEffectWithSoundId:filePath: 设置的soundId相同 |
filePath | 文件路径,支持本地文件和网络url |
cycles | 音效循环播放次数
|
publish | 是否将音效传到远端
|
- (int) stopAudioEffectWithSoundId: | (NSInteger) | soundId |
停止播放音效
soundId | 用户给该音效文件分配的ID,每个音效均有唯一的ID,如果你已通过 preloadAudioEffectWithSoundId:filePath: 将音效加载至内存,确保这里的soundId与 preloadAudioEffectWithSoundId:filePath: 设置的soundId相同 |
- (int) stopAllAudioEffects |
停止播放所有音效
- (int) setAudioEffectPublishVolumeWithSoundId: | (NSInteger) | soundId | |
volume: | (NSInteger) | volume | |
设置音效推流混音音量
soundId | 用户给该音效文件分配的ID |
volume | 推流混音音量,范围是:[0, 100],默认值:50 |
playAudioEffectWithSoundId:filePath:cycles:publish:
后调用 - (int) getAudioEffectPublishVolumeWithSoundId: | (NSInteger) | soundId |
获取音效推流混音音量
soundId | 用户给该音效文件分配的ID |
playAudioEffectWithSoundId:filePath:cycles:publish:
后调用 - (int) setAudioEffectPlayoutVolumeWithSoundId: | (NSInteger) | soundId | |
volume: | (NSInteger) | volume | |
设置音效本地播放音量
soundId | 用户给该音效文件分配的ID |
volume | 音效本地播放音量,范围:[0, 100],默认值:50 |
playAudioEffectWithSoundId:filePath:cycles:publish:
后调用 - (int) getAudioEffectPlayoutVolumeWithSoundId: | (NSInteger) | soundId |
获取音效本地播放音量
soundId | 用户给该音效文件分配的ID |
playAudioEffectWithSoundId:filePath:cycles:publish:
后调用 - (int) setAllAudioEffectsPlayoutVolume: | (NSInteger) | volume |
设置所有音效本地播音量
volume | 音效本地播放音量,范围:[0, 100],默认值:50 |
- (int) setAllAudioEffectsPublishVolume: | (NSInteger) | volume |
设置所有音效推流混音音量
volume | 推流混音音量,范围是:[0, 100],默认值:50 |
- (int) pauseAudioEffectWithSoundId: | (NSInteger) | soundId |
暂停音效
soundId | 用户给该音效文件分配的ID |
- (int) pauseAllAudioEffects |
暂停所有音效
- (int) resumeAudioEffectWithSoundId: | (NSInteger) | soundId |
恢复指定音效文件
soundId | 用户给该音效文件分配的ID |
- (int) resumeAllAudioEffects |
恢复所有音效文件
- (int) enableAudioDTX: | (BOOL) | enable |
是否开启语音活动检测
enable | YES表示开启, NO表示关闭, 默认关闭 |
- (int) enableAudioAMD: | (BOOL) | enable |
开启音频静音检测(Audio Mute Detection, 静音不发送音频包)
enable | YES表示开启,NO表示关闭,默认关闭; |
muteLocalMic:mode:
并且静音模式为 AliRtcMuteLocalAudioMode:AliRtcMuteAudioModeDefault
或者 AliRtcMuteLocalAudioMode:AliRtcMuteAllAudioMode
的模式下,停止音频编码和音频包的发送,节省用户流量。 - (int) enableEarBack: | (BOOL) | enable |
启用耳返
enable | 是否启用耳返 YES:开启; NO:关闭 默认: 关闭 |
- (int) setEarBackVolume: | (NSInteger) | volume |
设置耳返音量
volume | 音量大小,范围是:[0 ~ 100],默认值为100 |
- (int) startIntelligentDenoise |
开启智能降噪
- (void) stopIntelligentDenoise |
关闭智能降噪
- (int) enableMusicMode: | (BOOL) | enable |
启用音乐模式
enable | 是否启用音乐模式, YES表示开启, NO表示关闭, 默认关闭 |
setAudioProfile:audio_scene:
中设置场景为 AliRtcAudioScenario::AliRtcSceneMusicMode
来实现; - (BOOL) startRecord: | (AliRtcRecordType) | recordType | |
recordFormat: | (AliRtcRecordFormat) | recordFormat | |
filePath: | (NSString *_Nonnull) | filePath | |
audioConfig: | (AliRtcRecordAudioConfig *_Nullable) | audioConfig | |
videoConfig: | (AliRtcRecordVideoConfig *_Nullable) | videoConfig | |
开始录制
SDK提供了屏录录制的功能,可以录制本地或远端的音频流、视频流、相机流
recordType | 录制类型 详细定义见 AliRtcRecordType |
recordFormat | 录制文件格式 详细定义见 AliRtcRecordFormat |
filePath | 文件路径 |
audioConfig | 音频设置 详细定义见 AliRtcRecordAudioConfig |
videoConfig | 视频设置 详细定义见 AliRtcRecordVideoConfig |
- (void) stopRecord |
停止录制
SDK提供了停止录制的功能
- (int) startLastmileDetect |
开始网络质量探测
网络质量探测需要在未入会 joinChannel:name:onResultWithUserId:
情况下调用,探测结果在 onLastmileDetectResultWithQuality:
中回调
- (int) stopLastmileDetect |
停止网络质量探测
- (void) startLiveStreamingWithAuthInfo: | (AliRtcAuthInfo *_Nonnull) | authInfo | |
onResult: | (void(^)(int errCode)) | onResult | |
开始低延时互动直播拉流
该方法仅在低延迟互动模式 AliRtcInteractiveWithLowLatencyLive
下,角色为观众 AliRtcClientRolelive
时调用有意义
authInfo | 入会鉴权信息 |
onResult | 拉流结果,errCode
|
- (int) stopLiveStreaming |
停止低延时互动直播拉流
- (int) setLiveStreamingViewConfig: | (AliVideoCanvas *_Nullable) | canvas |
设置低延时互动直播拉流渲染Canvas
canvas | 渲染参数,包含了窗口以及渲染方式 |
- (int) setBeautyEffect: | (BOOL) | enable | |
config: | (AliRtcBeautyConfig *_Nullable) | config | |
开启或关闭美颜功能, 并设置美颜效果参数
enable |
|
config | 美颜效果参数, 详细定义见 AliRtcBeautyConfig |
- (int) snapshotVideo: | (NSString *_Nullable) | userId | |
type: | (AliRtcVideoTrack) | type | |
视频截图功能
userId | 用户ID,userId 为nil或者为""代表本地用户 |
type | 视频流类型,只支持 AliRtcVideoTrack::AliRtcVideoTrackCamera 和 AliRtcVideoTrack::AliRtcVideoTrackScreen |
AliRtcEngineDelegate::onSnapshotComplete:videoTrack:image:success:
AliRtcEngineDelegate::onSnapshotComplete:videoTrack:image:success:
回调获取当前截图画面。 - (int) sendMediaExtensionMsg: | (NSData *_Nonnull) | data | |
repeatCount: | (int) | repeatCount | |
发送媒体扩展信息
SDK提供了发送和接收媒体扩展信息的功能,接收端参考 AliRtcEngineDelegate::onMediaExtensionMsgReceived:message:
,使用场景:
data | 扩展信息内容, 长度限制为最大8字节 |
repeatCount | 重复次数,代表消息冗余度,用于防止网络丢包导致的消息丢失 |
- (int) addVideoWatermark: | (AliRtcVideoTrack) | track | |
image: | (NSString *_Nonnull) | imageUrl | |
config: | (AliRtcWatermarkConfig *_Nullable) | config | |
添加水印
SDK提供了添加水印的功能,适用于推送屏幕流或者相机流场景
track | 视频流类型,只支持 AliRtcVideoTrack::AliRtcVideoTrackCamera 和 AliRtcVideoTrack::AliRtcVideoTrackScreen |
imageUrl | png 文件路径 |
config | 水印配置 详细定义见 AliRtcWatermarkConfig |
- (int) clearVideoWatermark: | (AliRtcVideoTrack) | track |
去除水印
SDK提供了清理水印的功能,适用于推送屏幕流或者相机流场景
track | 视频流类型,只支持 AliRtcVideoTrack::AliRtcVideoTrackCamera 和 AliRtcVideoTrack::AliRtcVideoTrackScreen |
- (int) setPublishImage: | (NSString *_Nullable) | imageUrl |
设置上行弱网替代图片
imageUrl | 图片路径 |
onPublishStaticVideoFrame:isStaticFrame:
将触发,并使用该接口设置图片进行推流 - (void) postFeedbackWithUid: | (NSString *_Nullable) | uid | |
channleId: | (NSString *_Nullable) | channelId | |
description: | (NSString *_Nonnull) | description | |
type: | (AliRtcFeedbackType) | type | |
timeStamp: | (NSTimeInterval) | timeStamp | |
SDK问题反馈
uid | 问题用户id (允许为nil) |
channelId | 问题频道id (允许为nil) |
description | 问题描述(支持中英文, 必填) |
type | 问题类型,参考 AliRtcFeedbackType |
timeStamp | 问题发生的时间戳 (Unix时间戳,大致时间,无需特别精确,可以为0) |
- (int) sendDownlinkMessageResponse: | (AliRtcMessage *_Nonnull) | messageInfo |
发送下行通道消息(反馈消息处理结果)
messageInfo | 信息内容 |
AliRtcEngineDelegate::onDownlinkMessageNotify:
后,使用该接口发送下行接收反馈消息 - (int) sendUplinkMessage: | (AliRtcMessage *_Nonnull) | messageInfo |
发送上行通道消息
messageInfo | 信息内容 |
AliRtcEngineDelegate::onUplinkMessageResponse:
- (AliRtcEngine *_Nullable) createChannelWithDelegate: | (id< AliRtcEngineDelegate >_Nonnull) | delegate | |
extras: | (NSString *_Nullable) | extras | |
创建子频道
delegate | delegate |
extras | extras [可以为空 ""],参考文档:<a href="https://help.aliyun.com/document_detail/200048.html" >extras参数配置说明。 |
destroyChannel
进行释放 - (void) destroyChannel |
销毁子频道
使用 joinChannel:name:onResultWithUserId:
加入的是主频道,不需要调用destroyChannel销毁
- (int) startPublishLiveStreamWithURL: | (NSString *_Nonnull) | streamURL | |
liveTranscoding: | (AliRtcLiveTranscodingParam *_Nonnull) | trancoding | |
开启旁路直播
SDK提供了开启旁路直播的功能,可以把实时音视频流经过混流、混音处理转为标准直播流并推送至指定CDN供应商
streamURL | 推流地址 |
trancoding | 推流所需参数 详细定义见 AliRtcLiveTranscodingParam |
- (int) updatePublishLiveStreamWithURL: | (NSString *_Nonnull) | streamURL | |
liveTranscoding: | (AliRtcLiveTranscodingParam *_Nonnull) | trancoding | |
更新旁路直播相关参数
SDK提供了更新旁路直播的功能,用于实时更新旁路直播参数
streamURL | 推流地址 |
trancoding | 推流所需参数 详细定义见 AliRtcLiveTranscodingParam |
- (int) stopPublishLiveStreamWithURL: | (NSString *_Nonnull) | streamURL |
停止旁路直播
SDK提供了停止旁路直播相关参数的功能
streamURL | 推流地址 |
- (AliRtcLiveTranscodingState) GetPublishLiveStreamStateWithURL: | (NSString *_Nonnull) | streamURL |
获得旁路直播状态
streamURL | 推流地址 |
- (int) startChannelRelay: | (AliRtcChannelRelayConfiguration *_Nonnull) | configuration |
开启跨频道转推
普通情况下,一个主播只可以在一个频道内推拉流,该接口可以实现跨频道能力,支持主播(在A频道)将A频道的流推送到B频道,B频道相当于一个新主播入会并推流,对应的入会和推流回调依然会回调,与主播直接加入B频道行为一致。
如果两个频道内的两个主播互相向对应的频道进行跨频道转推,就可以实现主播间的跨频道连麦,典型场景如:两个直播间的主播PK功能。如下图示例:
channel-A channel-B --------------- --------------- 跨频道转发前: | 主播 A | | 主播 B | | 观众 U1 U2 | | 观众 U3 U4 | --------------- --------------- channel-A channel-B --------------- --------------- 跨频道转发后: | 主播 A B | | 主播 B A | | 观众 U1 U2 | | 观众 U3 U4 | --------------- ---------------
configuration | 频道配置信息 AliRtcChannelRelayConfiguration |
- (int) updateChannelRelay: | (AliRtcChannelRelayConfiguration *_Nonnull) | configuration |
- (int) stopChannelRelay |
停止跨频道转推
- (void) setPublishVideoStreamAttribute: | (AliRtcVideoTrack) | track | |
attr: | (NSString *_Nullable) | attr | |
- (int) enableEncryption: | (BOOL) | enable |
开启/关闭内置加解密功能:需要在入会前调用
enable | 是否开启 |
- (int) enableBackgroundExchange: | (BOOL) | enable | |
imagePath: | (NSString *_Nonnull) | path | |
scalMode: | (AliRtcBokehScaleModel) | model | |
开启/关闭虚拟背景替换功能
需要集成虚拟背景插件,虚拟背景简介及下载详见官网组件文档 ;
enable | 是否开启; |
path | 虚拟背景本地图片路径,支持JPG,PNG 格式; |
model | 背景图缩放模式,裁剪或缩放;
|
AliRtcPluginErrorCode
;- (int) enableBackgroundBlur: | (BOOL) | enable | |
blurDegree: | (uint32_t) | blurDegree | |
开启/关闭虚拟背景虚化功能
需要集成虚拟背景插件,虚拟背景简介及下载详见官网组件文档 ; 需要下载及集成虚拟背景插件,背景替换与背景虚化不可同时使用,如开启虚拟背景开关后再次开启背景虚化,则只有背景虚化效果;
enable | 是否开启; |
blurDegree | 虚化程度 取值范围 [0-100]; |
AliRtcPluginErrorCode
;+ (instancetype _Nonnull) sharedInstance: | (id< AliRtcEngineDelegate >_Nullable) | delegate | |
extras: | (NSString *_Nullable) | extras | |
获取一个AliRtcEngine实例
delegate | 用于接收AliRTC回调的代理。 |
extras | 用于接收来自客户灰度下发的参数,通过JSON配置SDK的特别功能,可以是空字符串。详情请参见官网有关extras功能说明。 |
该方法为同步调用,以单例的形式提供对象创建。
createChannelWithDelegate:extras:
+ (void) destroy |
销毁 AliRtcEngine
调用该方法将会释放所有内部使用的资源,当完成音视频通信之后都建议调用该方法释放实例.调用该方法后,你将不能再使用 AliRtcEngine
的其他方法和任何回调,如需要再次使用需要重新调用 AliRtcEngine::sharedInstance:extras:
方法创建一个新的实例。
AliRtcEngine
实例,请开发者务必保证 destroy 方法执行结束后再创建实例。 + (NSString *_Nonnull) getSdkVersion |
查询SDK当前版本号
+ (int) setLogDirPath: | (NSString *_Nullable) | logDirPath |
设置SDK日志文件保存路径
logDirPath | 日志文件保存目录的绝对路径,该参数是一个目录路径,而不是文件的路径。 |
AliRtcErrLogRootPathError
: 路径已存在或因权限问题不可访问。AliRtcErrLogAlreadyInit
: log对象已经初始化过。+ (void) uploadLog |
上传日志文件
用户主动调用此接口,将当前日志目录下的所有未上传的日志文件进行压缩、打包、上传。
+ (NSString *_Nullable) getErrorDescription: | (NSInteger) | errCode |
- (int) setAudioOnlyMode: | (BOOL) | audioOnly |
设置音频模式还是音视频模式
audioOnly |
|
joinChannel:name:onResultWithUserId:
之前设置 - (int) joinChannel: | (AliRtcAuthInfo *_Nonnull) | authInfo | |
name: | (NSString *_Nullable) | userName | |
onResult: | (void(^)(NSInteger errCode, NSString *_Nonnull channel, NSInteger elapsed)) | onResult | |
加入频道
authInfo | 认证信息,从App Server获取。 |
userName | 任意用于显示的用户名称。不是用户ID |
onResult | 当joinChannel执行结束后调用这个回调 |
- (int) joinChannel: | (AliRtcAuthInfo *_Nonnull) | authInfo | |
name: | (NSString *_Nullable) | userName | |
onResultWithUserId: | (void(^)(NSInteger errCode, NSString *_Nonnull channel, NSString *_Nonnull userId, NSInteger elapsed)) | onResult | |
加入频道
该方法让用户加入频道,一个频道内可以加入多个用户进行互相通话。
一般在调用该方法前会根据场景先选择频道模式,通过调用 setChannelProfile:
实现,默认频道模式为通信模式 AliRtcChannelProfile::AliRtcCommunication
authInfo | 认证信息,从App Server获取。 |
userName | 任意用于显示的用户名称。不是用户ID |
onResult | 当joinChannel执行结束后调用这个回调 |
onJoinChannelResult:channel:userId:elapsed:
onJoinChannelResult:channel:userId:elapsed:
判断,参数onResult也会回调onRemoteUserOnLineNotify:elapsed:
回调leaveChannel
离会,且确保 onLeaveChannelResult:stats:
回调收到后,再次调用进行入会switchChannel:
进行快速切换其他房间joinChannel:name:onResultWithUserId:
前调用 setDefaultSubscribeAllRemoteAudioStreams:
和 setDefaultSubscribeAllRemoteVideoStreams:
startChannelRelay:
实现跨频道通信,可以方便的实现两个不同直播间主播的互通联动 - (int) setParameter: | (NSString *_Nonnull) | param |
设置自定义参数
param | 自定义参数 |
- (int) leaveChannel |
离开频道
调用该方法代表离开频道,即挂断或者停止通话。
该方法为异步方法,调用后收到 onLeaveChannelResult:stats:
代表退出频道完成,同时会触发远端用户收到 onRemoteUserOffLineNotify:offlineReason:
回调。
如果未加入频道入会,leaveChannel
不会有任何影响。加入频道后,必须要调用该方法离开频道,否则无法加入其他频道。
onLeaveChannelResult:stats:
leaveChannel
后立刻调用 AliRtcEngine::destroy
方法,SDK将会无法触发 onLeaveChannelResult:stats:
回调 - (int) switchChannel: | (AliRtcAuthInfo *_Nonnull) | authInfo |
切换频道
当我们已经在一个频道中想要加入另外一个频道时,通常我们需要离会之后在收到离会回调之后再加入到另外一个频道中,调用方法可以实现快速切换频道。
成功调用该方切换频道后,本地会先收到离开原频道的回调 onLeaveChannelResult:stats:
,再收到成功加入新频道的回调 onJoinChannelResult:channel:userId:elapsed:
.
authInfo | 认证信息,从App Server获取。 |
AliRtcErrInner
:SDK未初始化或已销毁AliRtcErrSdkInvalidState
:当前未加入任何频道或者频道模式和角色不匹配,请确认频道为互动模式,用户角色为观众AliRtcErrInvalidArguments
:鉴权信息非法,请确认是否使用同一个authinfo多次加入同一个频道- (int) setChannelProfile: | (AliRtcChannelProfile) | profile |
设置频道模式
根据业务需求可以配置不同的频道模式,AliRTC会根据不用的频道模式模式采用不用的策略,目前主要提供通信模式(默认)、互动模式、低延迟互动直播模式
【通信模式 AliRtcCommunication】
【互动模式 AliRtcInteractivelive】
setClientRole:
进行设置。【低延迟互动直播模式 AliRtcInteractiveWithLowLatencyLive】
startLiveStreamingWithAuthInfo:onResult:
进行拉流profile | 频道模式类型, 详细请参考 AliRtcChannelProfile |
leaveChannel
后可以重新设置 - (int) setClientRole: | (AliRtcClientRole) | role |
设置互动模式下的用户角色
该方法在 ChannelProfile 设置为 AliRtcInteractivelive
时有效
该方法为异步方法,可以在入会前调用,也可以在入会后调用进行用户角色切换,默认角色为:观众角色
onRemoteUserOnLineNotify:elapsed:
回调publishLocalVideoStream:
和 publishLocalAudioStream:
onUpdateRoleNotifyWithOldRole:newRole:
回调:onRemoteUserOnLineNotify:elapsed:
回调publishLocalVideoStream:
和 publishLocalAudioStream:
onRemoteUserOffLineNotify:offlineReason:
回调role | 用户角色类型 AliRtcClientRole |
AliRtcInteractivelive
下调用有意义,入会前/会议中均可设置 onUpdateRoleNotifyWithOldRole:newRole:
回调后,才能再次调用有效 - (AliRtcClientRole) getClientRole |
- (int) refreshAuthInfo: | (AliRtcAuthInfo *_Nonnull) | authInfo |
刷新鉴权信息
该方法用于更新鉴权信息 AliRtcAuthInfo
,主要为了防止鉴权过期,导致推流失败,当我们收到 onAuthInfoWillExpire
回调时,应用应当更新鉴权信息
authInfo | 鉴权信息 |
- (int) setLocalViewConfig: | (AliVideoCanvas *_Nullable) | viewConfig | |
forTrack: | (AliRtcVideoTrack) | track | |
设置本地预览显示视图
viewConfig | 本地视频显示属性, 详细见AliVideoCanvas |
track | 只支持AliRtcVideoTrackCamera 和AliRtcVideoTrackScreen |
AliVideoCanvas::view
为nil,则停止显示。 如果需要重新设置AliVideoCanvas::renderMode
,请保持canvas中其他属性不变,仅修改 AliVideoCanvas::renderMode
。 如果需要重新设置AliVideoCanvas::mirrorMode
,请保持canvas中其他属性不变,仅修改 AliVideoCanvas::mirrorMode
。 - (int) startPreview |
开启本地视频预览
setLocalViewConfig:forTrack:
设置显示的view,则无法预览。 可以在 joinChannel:name:onResultWithUserId:
之前就开启预览会自动打开摄像头。 - (int) stopPreview |
- (int) setCameraCapturerConfiguration: | (AliRtcCameraCapturerConfiguration *_Nonnull) | config |
设置camera采集偏好
config | 偏好设置
|
- (int) publishLocalVideoStream: | (BOOL) | enabled |
是否推送本地视频流
enabled | 是否开启/关闭本地视频流推送
|
- (int) enableLocalVideo: | (BOOL) | enabled |
禁用或启用本地视频采集
enabled |
|
onUserVideoEnabled:videoEnabled:
获取用法是否禁用或启用本地视频采集状态。 - (int) muteLocalCamera: | (BOOL) | mute | |
forTrack: | (AliRtcVideoTrack) | track | |
停止/恢复本地视频数据发送
mute | YES表示视频数据发送黑帧;NO表示恢复正常 |
track | 只支持AliRtcVideoTrackCamera |
- (void) setVideoEncoderConfiguration: | (AliRtcVideoEncoderConfiguration *_Nullable) | config |
设置相机流视频编码属性
该方法用于设置相机流视频编码属性对应的视频参数,如分辨率、帧率、码率、视频方向等 所有设置的参数都有相应的范围限制,如果设置的参数不在有效范围内,SDK会自动调节
config | 预定义的编码属性,详见AliRtcVideoEncoderConfiguration |
- (void) setScreenShareEncoderConfiguration: | (AliRtcScreenShareEncoderConfiguration *_Nullable) | config |
设置屏幕流视频编码属性
该方法用于设置屏幕流视频编码属性对应的视频参数,如分辨率、帧率、码率、视频方向等 所有设置的参数都有相应的范围限制,如果设置的参数不在有效范围内,SDK会自动调节
config | 预定义的屏幕共享编码属性,详见AliRtcScreenShareEncoderConfiguration |
- (int) muteLocalMic: | (BOOL) | mute | |
mode: | (AliRtcMuteLocalAudioMode) | mode | |
停止/恢复本地音频数据发送
mute |
|
- (int) publishLocalAudioStream: | (BOOL) | enabled |
是否推送音频流
enabled | 是否开启/关闭本地音频流推送
|
- (int) startScreenShareWithDesktopId: | (int) | desktopId | |
config: | (AliRtcScreenShareConfig *_Nonnull) | config | |
根据桌面Id进行屏幕分享
desktopId | 桌面Id(可通过GetScreenShareSourceInfo接口获取) |
config | 屏幕分享配置,详见 AliRtcScreenShareConfig |
- (int) startScreenShareWithWindowId: | (int) | windowId | |
config: | (AliRtcScreenShareConfig *_Nonnull) | config | |
根据窗口id进行屏幕分享
windowId | 窗口id(可通过GetScreenShareSourceInfo接口获取) |
config | 屏幕分享配置,详见 AliRtcScreenShareConfig |
- (int) stopScreenShare |
停止屏幕分享
- (int) updateScreenShareConfig: | (AliRtcScreenShareConfig *_Nonnull) | config |
- (NSArray< AliRtcScreenSourceInfo * > *_Nullable) getScreenShareSourceInfoWithType: | (AliRtcScreenShareType) | type |
- (int) setRemoteViewConfig: | (AliVideoCanvas *_Nonnull) | canvas | |
uid: | (NSString *_Nonnull) | uid | |
forTrack: | (AliRtcVideoTrack) | track | |
设置远端视频显示视图
canvas | 本地视频显示属性, 详细见AliVideoCanvas |
uid | User ID,从App server分配的唯一标示符 |
track | 只支持AliRtcVideoTrack::AliRtcVideoTrackCamera 和AliRtcVideoTrack::AliRtcVideoTrackScreen |
AliVideoCanvas::view
为nil,则停止显示 如果需要重新设置AliVideoCanvas::renderMode
,请保持canvas中其他属性不变,仅修改 AliVideoCanvas::renderMode
如果需要重新设置AliVideoCanvas::mirrorMode
,请保持canvas中其他属性不变,仅修改 AliVideoCanvas::mirrorMode
- (int) setRemoteAudioVolume: | (NSString *_Nonnull) | uid | |
volume: | (NSInteger) | volume | |
调节本地播放的指定远端用户音量
uid | 用户ID,从App server分配的唯一标示符 |
volume | 播放音量,取值范围[0,100] 0:静音;100:原始音量 |
- (int) muteRemoteAudioPlaying: | (NSString *_Nonnull) | uid | |
mute: | (BOOL) | mute | |
停止/恢复远端指定用户的音频流的播放
uid | 用户ID , 从App server分配的唯一标示符 |
mute | YES表示停止播放; NO表示恢复播放 |
- (int) muteAllRemoteAudioPlaying: | (BOOL) | mute |
停止/恢复远端的所有音频流的播放
mute | YES表示停止播放;NO表示恢复播放 |
- (BOOL) isLocalVideoStreamPublished |
- (BOOL) isScreenSharePublished |
查询是否设置推送屏幕分享
startScreenShareWithDesktopId
或 startScreenShareWithWindowId
方法开启屏幕共享推送 - (BOOL) isLocalAudioStreamPublished |
查询是否设置推送音频流
publishLocalAudioStream
方法设置为不推送 - (int) publishLocalDualStream: | (BOOL) | enabled |
是否推送次要视频流
enabled | 是否开启/关闭次要视频流推送
|
publishLocalVideoStream
方法开启视频流推送 - (BOOL) isDualStreamPublished |
查询是否设置推送次要流
publishLocalDualStream
方法设置为推送 - (int) setRemoteVideoStreamType: | (NSString *_Nonnull) | uid | |
type: | (AliRtcVideoStreamType) | streamType | |
设置订阅相机流格式,大流或小流
uid | userId,从App server分配的唯一标示符 |
streamType | 流类型
|
publishLocalDualStream:
打开双流模式,接收端才可以选择订阅大流还是小流,否则订阅的只能是大流; - (int) setRemoteDefaultVideoStreamType: | (AliRtcVideoStreamType) | streamType |
设置默认订阅的相机流格式,大流或小流;如果不设置,则默认订阅大流;
streamType | 流类型
|
- (int) subscribeAllRemoteAudioStreams: | (BOOL) | sub |
停止/恢复订阅所有远端音频流
sub | 是否订阅所有远端音频流
|
setDefaultSubscribeAllRemoteAudioStreams:
和 subscribeRemoteAudioStream:sub:
都不会生效; - (int) subscribeAllRemoteVideoStreams: | (BOOL) | sub |
停止/恢复订阅所有远端视频流
sub | 是否订阅所有远端视频流
|
setDefaultSubscribeAllRemoteVideoStreams:
和 subscribeRemoteVideoStream:track:sub:
都不会生效; - (int) subscribeRemoteAudioStream: | (NSString *_Nonnull) | uid | |
sub: | (BOOL) | sub | |
停止/恢复订阅特定远端用户的音频流
uid | userId,从App server分配的唯一标示符 |
sub | 是否订阅远端用户的音频流
|
subscribeAllRemoteAudioStreams:
停止订阅所有远端音频,则此接口调用无效;subscribeAllRemoteAudioStreams:
是全局控制,subscribeRemoteAudioStream 是单独控制。 - (int) subscribeRemoteVideoStream: | (NSString *_Nonnull) | uid | |
track: | (AliRtcVideoTrack) | track | |
sub: | (BOOL) | sub | |
停止/恢复订阅远端用户的视频流
uid | userId,从App server分配的唯一标示符 |
track | 视频流类型
|
sub | 是否订阅远端用户的视频流
|
subscribeAllRemoteVideoStreams:
停止订阅所有远端视频,则此接口调用无效;subscribeAllRemoteVideoStreams:
是全局控制,SubscribeRemoteVideoStream 是单独控制。 - (int) setDefaultSubscribeAllRemoteAudioStreams: | (BOOL) | sub |
设置是否默认订阅音频流
sub | 是否默认订阅音频流
|
subscribeRemoteAudioStream:sub:
,对指定的用户进行订阅或取消订阅操作;subscribeAllRemoteAudioStreams:
这个总开关控制,假设 subscribeAllRemoteAudioStreams:
设置为NO,则订阅全部关闭,其他启动行为全部不生效; - (int) setDefaultSubscribeAllRemoteVideoStreams: | (BOOL) | sub |
设置是否默认订阅视频流
sub | 是否默认订阅视频流
|
subscribeRemoteVideoStream:track:sub:
,对指定的用户进行订阅或取消订阅操作;subscribeAllRemoteVideoStreams:
这个总开关控制,假设 subscribeAllRemoteVideoStreams:
设置为NO,则订阅全部关闭,其他启动行为全部不生效; - (NSArray< NSString * > *_Nullable) getOnlineRemoteUsers |
获取远端在线用户列表
AliRtcInteractivelive
模式,只有设置角色为 AliRtcClientRoleInteractive
的用户为在线用户,本方法不返回角色为 AliRtcClientRoleLive
的用户 - (BOOL) isUserOnline: | (NSString *_Nonnull) | uid |
查询用户是否在线
uid | 用户ID,从App server分配的唯一标示符。不可为NULL |
- (AliRtcConnectionStatus) getCurrentConnectionStatus |
获取当前网络链接状态
AliRtcConnectionStatus
onConnectionStatusChange:reason:
回调通知 AliRtcConnectionStatusDisconnected
- (void) setCurrentAudioCapture: | (NSString *_Nonnull) | capture |
选择录音设备(Name)
capture | 音频采集设备名称 |
- (void) setCurrentAudioCaptureWithID: | (NSString *_Nonnull) | captureID |
选择录音设备(ID)
captureID | 音频采集设备Id |
- (void) setCurrentAudioRenderer: | (NSString *_Nonnull) | renderer |
选择扬声器(Name)
renderer | 音频播放设备名称 |
- (void) setCurrentAudioRendererWithID: | (NSString *_Nonnull) | rendererID |
选择扬声器(ID)
rendererID | 音频播放设备id |
- (NSArray< AliRtcDeviceInfo * > *_Nullable) getCameraList |
获取摄像头列表
- (void) setCurrentCamera: | (NSString *_Nonnull) | camera |
选择摄像头(Name)
camera | 摄像头名称 |
- (void) setCurrentCameraWithID: | (NSString *_Nonnull) | cameraID |
选择摄像头(ID)
cameraID | 摄像头ID |
- (void) startAudioCapture |
开启音频采集
此接口可以控制提前打开音频采集,如果不设置,则SDK会自动控制音频采集设备:
publishLocalAudioStream:
,SDK在入会后会打开音频采集publishLocalAudioStream:
,SDK在入会后不会打开音频采集- (void) startAudioCapture: | (BOOL) | keepAlive |
开启音频采集
此接口可以控制提前打开音频采集,如果不设置,则SDK会自动控制音频采集设备:
publishLocalAudioStream:
,SDK在入会后会打开音频采集publishLocalAudioStream:
,SDK在入会后不会打开音频采集keepAlive | YES: 离会后采集设备保持开启状态;NO: 离会后采集设备关闭 |
- (void) stopAudioCapture |
关闭音频采集
- (void) startAudioPlayer |
开启音频播放
- (void) stopAudioPlayer |
关闭音频播放
startAudioPlayer
对应 - (int) enableAudioDTX: | (BOOL) | enable |
是否开启语音活动检测
enable | YES表示开启, NO表示关闭, 默认关闭 |
- (int) enableAudioAMD: | (BOOL) | enable |
开启音频静音检测(Audio Mute Detection, 静音不发送音频包)
enable | YES表示开启,NO表示关闭,默认关闭; |
muteLocalMic:mode:
并且静音模式为 AliRtcMuteLocalAudioMode:AliRtcMuteAudioModeDefault
或者 AliRtcMuteLocalAudioMode:AliRtcMuteAllAudioMode
的模式下,停止音频编码和音频包的发送,节省用户流量。 - (int) startIntelligentDenoise |
开启智能降噪
- (void) stopIntelligentDenoise |
关闭智能降噪
- (int) enableMusicMode: | (BOOL) | enable |
启用音乐模式
enable | 是否启用音乐模式, YES表示开启, NO表示关闭, 默认关闭 |
setAudioProfile:audio_scene:
中设置场景为 AliRtcAudioScenario::AliRtcSceneMusicMode
来实现; - (int) setRecordingDeviceMute: | (BOOL) | mute |
静音音频采集设备
mute | TRUE:设备设置为静音,FALSE: 设备设置为不静音 |
- (BOOL) getRecordingDeviceMute |
获取音频采集设备静音状态
- (int) setPlaybackDeviceMute: | (BOOL) | mute |
静音音频播放设备
mute | TRUE:设备设置为静音,FALSE: 设备设置为不静音 |
- (BOOL) getPlaybackDeviceMute |
获取音频播放设备静音状态
- (void) setLogLevel: | (AliRtcLogLevel) | logLevel |
设置日志等级
logLevel | Log级别,详见 AliRtcLogLevel 枚举类型 |
AliRtcLogLevel::AliRtcLogLevelInfo
。 - (int) setRecordingVolume: | (NSInteger) | volume |
设置录音音量
volume | 录音音量,取值范围[0,400]
|
- (int) setPlayoutVolume: | (NSInteger) | volume |
设置播放音量
volume | 播放音量,取值范围[0,400]
|
- (int) setRecordingDeviceVolume: | (NSInteger) | volume |
设置音频采集设备音量
volume | 音量范围 [0, 100] |
- (int) getRecordingDeviceVolume |
获取音频采集设备音量
- (int) setPlayoutDeviceVolume: | (NSInteger) | volume |
设置音频播放设备音量
volume | 音量范围 [0, 100] |
- (int) getPlayoutDeviceVolume |
获取音频播放设备音量
- (int) setAudioProfile: | (AliRtcAudioProfile) | audio_profile | |
audio_scene: | (AliRtcAudioScenario) | audio_scene | |
设置音频profile
audio_profile | 音频采集/编码模式参数, 详见 AliRtcAudioProfile |
audio_scene | 音频场景模式参数,详见 AliRtcAudioScenario |
joinChannel:name:onResultWithUserId:
前设置有效; - (int) setAudioEffectVoiceChangerMode: | (AliRtcAudioEffectVoiceChangerMode) | mode |
- (int) setAudioEffectPitchValue: | (double) | value |
设置变调参数
value | 变调参数,范围:[0.5, 2.0],1.0表示音调不变,小于1.0表示音调降低,大于1.0表示音调升高,默认1.0 |
- (int) setAudioEffectReverbMode: | (AliRtcAudioEffectReverbMode) | mode |
- (int) setAudioEffectReverbParamType: | (AliRtcAudioEffectReverbParamType) | type | |
value: | (float) | value | |
设置混响音效类型
type | 参考 AliRtcAudioEffectReverbParamType 对应的混响类型 |
value | 混响参数值,不同混响类型的取值范围参考 AliRtcAudioEffectReverbParamType 中取值说明 |
setAudioEffectReverbMode:
之后调用 - (BOOL) isCameraOn |
检查camera是否打开
- (BOOL) isInCall |
获取状态:当前是否在频道中
- (BOOL) isAudioOnly |
查询是否纯音频模式
- (NSDictionary *_Nullable) getUserInfo: | (NSString *_Nonnull) | uid |
查询远端用户状态
uid | 用户ID。从App server分配的唯一标示符 |
+ (void) setH5CompatibleMode: | (BOOL) | comp |
设置H5兼容模式
互动模式下,是否需要与Web SDK互通。如果使用Native SDK用户加入频道,需要与通过Web SDK加入频道的用户进行互通,则必须使用H5兼容模式,否则,Web用户查看Native用户将是黑屏。
comp |
|
+ (BOOL) getH5CompatibleMode |
检查当前是否兼容H5、与Web SDK互通
- (int) showDebugView: | (NSTextView *_Nonnull) | view | |
showType: | (AliRtcShowDebugViewType) | showType | |
userId: | (NSString *_Nullable) | userId | |
展示用户Debug数据
view | 对外展示的View,由客户传入,显示样式由客户指定 |
showType | 展示类型:0: 不显示 1.音频 2.视频 3.全部;另外可以传入特殊的值来展示 |
userId | 对应用户数据 |
- (int) addVideoWatermark: | (AliRtcVideoTrack) | track | |
image: | (NSString *_Nonnull) | imageUrl | |
config: | (AliRtcWatermarkConfig *_Nonnull) | config | |
添加水印
SDK提供了添加水印的功能,适用于推送屏幕流或者相机流场景
track | 视频流类型,只支持 AliRtcVideoTrack::AliRtcVideoTrackCamera 和 AliRtcVideoTrack::AliRtcVideoTrackScreen |
imageUrl | png 文件路径 |
config | 水印配置 详细定义见 AliRtcWatermarkConfig |
- (int) clearVideoWatermark: | (AliRtcVideoTrack) | track |
去除水印
SDK提供了清理水印的功能,适用于推送屏幕流或者相机流场景
track | 视频流类型,只支持 AliRtcVideoTrack::AliRtcVideoTrackCamera 和 AliRtcVideoTrack::AliRtcVideoTrackScreen |
- (int) setPublishImage: | (NSString *_Nullable) | imageUrl |
设置上行弱网替代图片
imageUrl | 图片路径 |
onPublishStaticVideoFrame:isStaticFrame:
将触发,并使用该接口设置图片进行推流 - (int) enableSystemAudio: | (BOOL) | enabled | |
deviceName: | (NSString *_Nullable) | deviceName | |
是否开启系统音频采集
enabled | 是否开启 |
deviceName | 音频播放设备 |
- (bool) isSystemAudioEnabled |
系统音频采集是否处于开启状态
- (int) setSystemAudioRecordingVolume: | (int) | volume |
设置系统音频采集后的推流音量
volume | 推流音量 |
- (int) getSystemAudioRecordingVolume |
获取系统音频采集后的推流音量
- (int) setSystemAudioPlayoutVolume: | (int) | volume |
设置系统音频采集后的播放音量
volume | 播放音量 |
- (int) getSystemAudioPlayoutVolume |
获取系统音频采集后的播放音量
- (int) startTestAudioRecordWithName: | (NSString *_Nonnull) | deviceName |
开始测试音频采集设备
deviceName | 音频采集设备Name |
- (int) stopTestAudioRecord |
停止测试音频采集设备
- (int) startTestAudioPlayoutWithName: | (NSString *_Nonnull) | deviceName | |
filePath: | (NSString *_Nonnull) | filePath | |
loopCycles: | (NSInteger) | loopCycles | |
开始测试音频播放设备
deviceName | 音频播放设备Name |
filePath | 音频文件路径 |
loopCycles | 循环次数,可以设置-1(无限循环)或者>0的正整数次,其他值无效 |
- (int) stopTestAudioPlayout |
停止测试音频播放设备
- (int) startLastmileDetect |
开始网络质量探测
网络质量探测需要在未入会 joinChannel:name:onResultWithUserId:
情况下调用,探测结果在 onLastmileDetectResultWithQuality:
中回调
- (int) stopLastmileDetect |
停止网络质量探测
- (void) subscribeAudioData: | (AliRtcAudioSource) | audioSource |
订阅音频数据
audioSource | 音频裸数据源类型,详见 AliRtcAudioSource |
setSubscribeAudioNumChannel:
与 setSubscribeAudioSampleRate:
设置输出音频数据参数 - (void) unSubscribeAudioData: | (AliRtcAudioSource) | audioSource |
取消订阅音频数据
audioSource | 音频裸数据源类型,详见 AliRtcAudioSource |
- (int) enableAudioVolumeIndication: | (NSInteger) | interval | |
smooth: | (NSInteger) | smooth | |
reportVad: | (NSInteger) | reportVad | |
设置音量回调频率和平滑系数
interval | 时间间隔,单位毫秒,最小值不得小于10ms, 建议设置300-500ms, <= 0表示不启用音量提示和说话人提示功能 |
smooth | 平滑系数,数值越大平滑程度越高,反之越低,实时性越好,建议设置3,范围[0, 9]; |
reportVad | 说话人检测开关,1: 开启,0: 关闭 |
AliRtcEngineDelegate::onAudioVolumeCallback:totalVolume:
和 AliRtcEngineDelegate::onActiveSpeaker:
回调 - (void) setSubscribeAudioNumChannel: | (AliRtcAudioNumChannel) | audioNumChannel |
设置回调音频声道数,默认单声道 (混音前数据不支持该参数设置)
audioNumChannel | 声道数,必须是 AliRtcAudioNumChannel |
subscribeAudioData:
前进行设置 - (void) setSubscribeAudioSampleRate: | (AliRtcAudioSampleRate) | audioSampleRate |
设置回调音频采样率,默认44100 (混音前数据不支持该参数设置)
audioSampleRate | 采样率,必须是 AliRtcAudioSampleRate |
subscribeAudioData:
前进行设置 - (BOOL) getVideoCaptureData: | (AliRtcVideoTrack) | videoTrack | |
videoSample: | (AliRtcVideoDataSample **) | p_sample | |
主动获取采集数据
videoTrack | 视频流类型 |
p_sample | 数据接收对象 |
onGetIfUserFetchObserverData
返回 YES 时有效 - (BOOL) getVideoPreEncoderData: | (AliRtcVideoTrack) | videoTrack | |
videoSample: | (AliRtcVideoDataSample **) | p_sample | |
主动获取编码前数据
videoTrack | 视频流类型 |
p_sample | 数据接收对象 |
onGetIfUserFetchObserverData
返回 YES 时有效 - (BOOL) getVideoRenderData: | (NSString *) | uid | |
videoTrack: | (AliRtcVideoTrack) | videoTrack | |
videoSample: | (AliRtcVideoDataSample **) | p_sample | |
主动获取拉流数据,onGetIfUserFetchObserverData 返回 YES 时有效
uid | 远端用户ID |
videoTrack | 视频流类型 |
p_sample | 数据接收对象 |
onGetIfUserFetchObserverData
返回 YES 时有效 - (int) setExternalVideoSource: | (BOOL) | enable | |
sourceType: | (AliRtcVideoSource) | type | |
renderMode: | (AliRtcRenderMode) | renderMode | |
启用外部视频输入源
enable | YES 开启,NO 关闭 |
type | 流类型 |
renderMode | 外部输入视频源宽高比和推流profile不一致时,会按照对应的rendermode做对应处理 |
启用外部视频输入源
enable |
|
type | 流类型,详见 AliRtcVideoSource
|
renderMode | 处理模式,外部输入视频源宽高比和推流profile不一致时,会按照对应的rendermode做对应处理,详见 AliRtcRenderMode
|
- (int) pushExternalVideoFrame: | (AliRtcVideoDataSample *_Nonnull) | frame | |
sourceType: | (AliRtcVideoSource) | type | |
输入视频数据
frame | 帧数据,详见 AliRtcVideoDataSample |
type | 流类型,详见 AliRtcVideoSource
|
- (int) setExternalAudioSource: | (BOOL) | enable | |
withSampleRate: | (NSUInteger) | sampleRate | |
channelsPerFrame: | (NSUInteger) | channelsPerFrame | |
设置是否启用外部音频输入源
enable | YES:开启; NO:关闭 |
sampleRate | 采样率 16000 48000... |
channelsPerFrame | 声道数 1:单声道; 2:双声道 |
- (int) pushExternalAudioFrameRawData: | (void *_Nonnull) | data | |
samples: | (NSUInteger) | samples | |
timestamp: | (NSTimeInterval) | timestamp | |
输入外部音频数据推流到远端
data | 音频数据buffer |
samples | 音频数据buffer长度 |
timestamp | 时间戳 |
AliRtcErrorCode::AliRtcErrAudioBufferFull
时,需要在间隔投递数据时间长度后再次重试投递 AliRtcErrorCode::AliRtcErrAudioBufferFull
时,说明内部缓冲区已满,建议等待20ms后再重新送当前数据帧; - (int) setExternalAudioVolume: | (int) | vol |
设置外部音频音量
vol | 音量,取值范围[0,100] |
- (int) getExternalAudioVolume |
获取混音音量
- (int) setMixedWithMic: | (BOOL) | mixed |
设置是否与麦克风采集音频混合
mixed | YES:混音;NO:完全替换麦克风采集数据 |
- (int) setExteranlAudioRender: | (BOOL) | enable | |
sampleRate: | (NSUInteger) | sampleRate | |
channelsPerFrame: | (NSUInteger) | channelsPerFrame | |
设置是否启用外部输入音频播放
enable | YES:开启; NO:关闭 |
sampleRate | 采样率 16000 48000... |
channelsPerFrame | 声道数 1:单声道; 2:双声道 |
- (int) pushExternalAudioRenderRawData: | (const void *_Nullable) | audioSamples | |
sampleLength: | (NSUInteger) | sampleLength | |
sampleRate: | (NSUInteger) | sampleRate | |
channelsPerFrame: | (NSUInteger) | channelsPerFrame | |
timestamp: | (long long) | timestamp | |
输入外部音频数据本地播放
audioSamples | 音频数据buffer |
sampleLength | 音频数据buffer长度 |
sampleRate | 输入音频数据的采样率 |
channelsPerFrame | 输入音频数据的声道数 |
timestamp | 时间戳 |
ErrorCodeEnum::ERR_AUDIO_BUFFER_FULL
时,需要在间隔投递数据时间长度后再次重试投递 ErrorCodeEnum::ERR_AUDIO_BUFFER_FULL
时,说明内部缓冲区已满,建议等待20ms后再重新送当前数据帧; - (int) startAudioAccompanyWithFile: | (NSString *_Nonnull) | filePath | |
onlyLocalPlay: | (BOOL) | onlyLocalPlay | |
replaceMic: | (BOOL) | replaceMic | |
loopCycles: | (NSInteger) | loopCycles | |
开始伴奏混音
filePath | 伴奏文件路径 |
onlyLocalPlay | 是否只本地播放 |
replaceMic | 是否替换掉MIC |
loopCycles | 循环次数,可以设置-1(无限循环)或者正整数 |
onAudioPlayingStateChanged:errorCode:
监听播放器状态 - (int) stopAudioAccompany |
停止伴奏混音
- (int) setAudioAccompanyVolume: | (NSInteger) | volume |
设置伴奏音量
volume | 伴奏音量,取值范围[0,100] |
- (int) setAudioAccompanyPublishVolume: | (NSInteger) | volume |
设置伴奏推流音量
volume | 伴奏推流音量,取值范围[0,100] |
- (int) getAudioAccompanyPublishVolume |
获取伴奏推流音量
- (int) setAudioAccompanyPlayoutVolume: | (NSInteger) | volume |
设置伴奏本地播放音量
volume | 伴奏本地播放音量,取值范围[0,100] |
- (int) getAudioAccompanyPlayoutVolume |
获取伴奏本地播放音量
- (int) pauseAudioAccompany |
暂停伴奏混音
- (int) resumeAudioAccompany |
重新开始伴奏混音
- (int) getAudioAccompanyDuration |
获取伴奏文件时长, 单位为毫秒
- (int) getAudioAccompanyCurrentPosition |
获取伴奏文件播放进度,单位为毫秒
- (int) setAudioAccompanyPosition: | (int) | pos |
设置伴奏文件的播放位置
pos | 进度条位置,单位为毫秒 |
- (int) preloadAudioEffectWithSoundId: | (NSInteger) | soundId | |
filePath: | (NSString *_Nonnull) | filePath | |
预加载音效文件
soundId | 用户给该音效文件分配的ID |
filePath | 音效文件路径,支持本地文件和网络url |
- (int) unloadAudioEffectWithSoundId: | (NSInteger) | soundId |
删除预加载的音效文件
soundId | 用户给该音效文件分配的ID |
preloadAudioEffectWithSoundId:filePath:
时传入的ID相同 - (int) playAudioEffectWithSoundId: | (NSInteger) | soundId | |
filePath: | (NSString *_Nonnull) | filePath | |
cycles: | (NSInteger) | cycles | |
publish: | (BOOL) | publish | |
开始播放音效
开始播放音效接口,可以多次调用该方法传入不同的soundId和filePath,同时播放多个音效文件,音效文件播放结束后,SDK 会触发 onAudioEffectFinished:
回调
soundId | 用户给该音效文件分配的ID,每个音效均有唯一的ID,如果你已通过 preloadAudioEffectWithSoundId:filePath: 将音效加载至内存,确保这里的soundId与 preloadAudioEffectWithSoundId:filePath: 设置的soundId相同 |
filePath | 文件路径,支持本地文件和网络url |
cycles | 音效循环播放次数
|
publish | 是否将音效传到远端
|
- (int) stopAudioEffectWithSoundId: | (NSInteger) | soundId |
停止播放音效
soundId | 用户给该音效文件分配的ID,每个音效均有唯一的ID,如果你已通过 preloadAudioEffectWithSoundId:filePath: 将音效加载至内存,确保这里的soundId与 preloadAudioEffectWithSoundId:filePath: 设置的soundId相同 |
- (int) stopAllAudioEffects |
停止播放所有音效
- (int) setAudioEffectPublishVolumeWithSoundId: | (NSInteger) | soundId | |
volume: | (NSInteger) | volume | |
设置音效推流混音音量
soundId | 用户给该音效文件分配的ID |
volume | 推流混音音量,范围是:[0, 100],默认值:50 |
playAudioEffectWithSoundId:filePath:cycles:publish:
后调用 - (int) getAudioEffectPublishVolumeWithSoundId: | (NSInteger) | soundId |
获取音效推流混音音量
soundId | 用户给该音效文件分配的ID |
playAudioEffectWithSoundId:filePath:cycles:publish:
后调用 - (int) setAudioEffectPlayoutVolumeWithSoundId: | (NSInteger) | soundId | |
volume: | (NSInteger) | volume | |
设置音效本地播放音量
soundId | 用户给该音效文件分配的ID |
volume | 音效本地播放音量,范围:[0, 100],默认值:50 |
playAudioEffectWithSoundId:filePath:cycles:publish:
后调用 - (int) getAudioEffectPlayoutVolumeWithSoundId: | (NSInteger) | soundId |
获取音效本地播放音量
soundId | 用户给该音效文件分配的ID |
playAudioEffectWithSoundId:filePath:cycles:publish:
后调用 - (int) setAllAudioEffectsPlayoutVolume: | (NSInteger) | volume |
设置所有音效本地播音量
volume | 音效本地播放音量,范围:[0, 100],默认值:50 |
- (int) setAllAudioEffectsPublishVolume: | (NSInteger) | volume |
设置所有音效推流混音音量
volume | 推流混音音量,范围是:[0, 100],默认值:50 |
- (int) pauseAudioEffectWithSoundId: | (NSInteger) | soundId |
暂停音效
soundId | 用户给该音效文件分配的ID |
- (int) pauseAllAudioEffects |
暂停所有音效
- (int) resumeAudioEffectWithSoundId: | (NSInteger) | soundId |
恢复指定音效文件
soundId | 用户给该音效文件分配的ID |
- (int) resumeAllAudioEffects |
恢复所有音效文件
- (BOOL) startRecord: | (AliRtcRecordType) | recordType | |
recordFormat: | (AliRtcRecordFormat) | recordFormat | |
filePath: | (NSString *_Nonnull) | filePath | |
audioConfig: | (AliRtcRecordAudioConfig *_Nonnull) | audioConfig | |
videoConfig: | (AliRtcRecordVideoConfig *_Nonnull) | videoConfig | |
isFragment: | (BOOL) | isFragment | |
开始录制
SDK提供了屏录录制的功能,可以录制本地或远端的音频流、视频流、相机流
recordType | 录制类型 详细定义见 AliRtcRecordType |
recordFormat | 录制文件格式 详细定义见 AliRtcRecordFormat |
filePath | 文件路径 |
audioConfig | 音频设置 详细定义见 AliRtcRecordAudioConfig |
videoConfig | 视频设置 详细定义见 AliRtcRecordVideoConfig |
isFragment | 是否支持mp4内部分段,只在录制mp4时有效 |
startRecord:filePath:recordLayout
- (BOOL) updateRecordLayout: | (AliRtcRecordVideoLayout *_Nonnull) | layout |
更新录制内容信息
SDK提供了更新录制内容信息的功能,用于实时更新录制模板内容设置
layout | 录制视频内容及布局, 详细定义见 AliRtcRecordVideoLayout |
- (BOOL) addRecordTemplate: | (AliRtcRecordTemplate *_Nonnull) | recordTemplate |
添加录制模板
SDK提供了添加录制模板的功能,用于添加录制模板
recordTemplate | 录制模板, 详细定义见 AliRtcRecordTemplate |
- (BOOL) startRecord: | (NSString *_Nonnull) | filePath | |
recordLayout: | (AliRtcRecordVideoLayout *_Nonnull) | recordLayout | |
开始录制
SDK提供了屏录录制的功能,可以录制本地或远端的音频流、视频流、相机流,窗口布局设置参考 AliEngineRecordVideoLayout
filePath | 文件路径 |
recordLayout | 视频窗口布局设置, 详细定义见 AliRtcRecordVideoLayout |
- (BOOL) pauseRecord |
暂停录制
SDK提供了暂停录制的功能
- (BOOL) resumeRecord |
重新开启录制
SDK提供了重新开始录制的功能
- (void) stopRecord |
停止录制
SDK提供了停止录制的功能
- (int) setBeautyEffect: | (bool) | enable | |
config: | (AliRtcBeautyConfig *_Nonnull) | confg | |
开启或关闭美颜功能, 并设置美颜效果参数
enable |
|
confg | 美颜效果参数, 详细定义见 AliRtcBeautyConfig |
- (int) snapshotVideo: | (NSString *_Nullable) | userId | |
type: | (AliRtcVideoTrack) | trackType | |
视频截图功能
userId | 用户ID,userId 为nil或者为""代表本地用户 |
trackType | 视频流类型,只支持 AliRtcVideoTrack::AliRtcVideoTrackCamera 和 AliRtcVideoTrack::AliRtcVideoTrackScreen |
videoTrack: image: success:
videoTrack: image: success:
回调获取当前截图画面。 - (void) startLiveStreamingWithAuthInfo: | (AliRtcAuthInfo *_Nonnull) | authInfo | |
onResult: | (void(^)(int errCode)) | onResult | |
开始低延时互动直播拉流
该方法仅在低延迟互动模式 AliRtcInteractiveWithLowLatencyLive
下,角色为观众 AliRtcClientRolelive
时调用有意义
authInfo | 入会鉴权信息 |
onResult | 拉流结果,errCode
|
- (int) stopLiveStreaming |
停止低延时互动直播拉流
- (int) setLiveStreamingViewConfig: | (AliVideoCanvas *_Nullable) | canvas |
设置低延时互动直播拉流渲染Canvas
canvas | 渲染参数,包含了窗口以及渲染方式 |
- (int) setExternalAudioRenderVolume: | (int) | vol |
设置音频播放音量
vol | 音量 0-100 |
- (int) getExternalAudioRenderVolume |
获取音频播放音量
- (int) sendMediaExtensionMsg: | (NSData *_Nonnull) | data | |
repeatCount: | (int) | repeatCount | |
发送媒体扩展信息
SDK提供了发送和接收媒体扩展信息的功能,接收端参考 AliRtcEngineDelegate::onMediaExtensionMsgReceived:message:
,使用场景:
data | 扩展信息内容, 长度限制为最大8字节 |
repeatCount | 重复次数,代表消息冗余度,用于防止网络丢包导致的消息丢失 |
- (void) postFeedbackWithUid: | (NSString *_Nullable) | uid | |
channleId: | (NSString *_Nullable) | channelId | |
description: | (NSString *_Nonnull) | description | |
type: | (AliRtcFeedbackType) | type | |
timeStamp: | (NSTimeInterval) | timeStamp | |
SDK问题反馈
uid | 问题用户id (允许为nil) |
channelId | 问题频道id (允许为nil) |
description | 问题描述(支持中英文, 必填) |
type | 问题类型,参考 AliRtcFeedbackType |
timeStamp | 问题发生的时间戳 (Unix时间戳,大致时间,无需特别精确,可以为0) |
- (AliRtcEngine *_Nullable) createChannelWithDelegate: | (id< AliRtcEngineDelegate >_Nonnull) | delegate | |
extras: | (NSString *_Nullable) | extras | |
创建子频道
delegate | delegate |
extras | extras [可以为空 ""],参考文档:<a href="https://help.aliyun.com/document_detail/200048.html" >extras参数配置说明。 |
destroyChannel
进行释放 - (void) destroyChannel |
销毁子频道
使用 joinChannel:name:onResultWithUserId:
加入的是主频道,不需要调用destroyChannel销毁
- (int) startPublishLiveStreamWithURL: | (NSString *_Nonnull) | streamURL | |
liveTranscoding: | (AliRtcLiveTranscodingParam *_Nonnull) | trancoding | |
开启旁路直播
SDK提供了开启旁路直播的功能,可以把实时音视频流经过混流、混音处理转为标准直播流并推送至指定CDN供应商
streamURL | 推流地址 |
trancoding | 推流所需参数 详细定义见 AliRtcLiveTranscodingParam |
- (int) updatePublishLiveStreamWithURL: | (NSString *_Nonnull) | streamURL | |
liveTranscoding: | (AliRtcLiveTranscodingParam *_Nonnull) | trancoding | |
更新旁路直播相关参数
SDK提供了更新旁路直播的功能,用于实时更新旁路直播参数
streamURL | 推流地址 |
trancoding | 推流所需参数 详细定义见 AliRtcLiveTranscodingParam |
- (int) stopPublishLiveStreamWithURL: | (NSString *_Nonnull) | streamURL |
停止旁路直播
SDK提供了停止旁路直播的功能
streamURL | 推流地址 |
- (AliRtcLiveTranscodingState) GetPublishLiveStreamStateWithURL: | (NSString *_Nonnull) | streamURL |
获得旁路直播状态
streamURL | 推流地址 |
- (int) startChannelRelay: | (AliRtcChannelRelayConfiguration *_Nonnull) | configuration |
开启跨频道转推
普通情况下,一个主播只可以在一个频道内推拉流,该接口可以实现跨频道能力,支持主播(在A频道)将A频道的流推送到B频道,B频道相当于一个新主播入会并推流,对应的入会和推流回调依然会回调,与主播直接加入B频道行为一致。
如果两个频道内的两个主播互相向对应的频道进行跨频道转推,就可以实现主播间的跨频道连麦,典型场景如:两个直播间的主播PK功能。如下图示例:
channel-A channel-B --------------- --------------- 跨频道转发前: | 主播 A | | 主播 B | | 观众 U1 U2 | | 观众 U3 U4 | --------------- --------------- channel-A channel-B --------------- --------------- 跨频道转发后: | 主播 A B | | 主播 B A | | 观众 U1 U2 | | 观众 U3 U4 | --------------- ---------------
configuration | 频道配置信息 AliRtcChannelRelayConfiguration |
- (int) updateChannelRelay: | (AliRtcChannelRelayConfiguration *_Nonnull) | configuration |
- (int) stopChannelRelay |
停止跨频道转推
- (void) setPublishVideoStreamAttribute: | (AliRtcVideoTrack) | track | |
attr: | (NSString *_Nullable) | attr | |
- (int) enableEncryption: | (BOOL) | enable |
开启/关闭内置加解密功能:需要在入会前调用
enable | 是否开启 |
- (int) enableBackgroundExchange: | (BOOL) | enable | |
imagePath: | (NSString *_Nonnull) | path | |
scalMode: | (AliRtcBokehScaleModel) | model | |
开启/关闭虚拟背景替换功能
需要集成虚拟背景插件,虚拟背景简介及下载详见官网组件文档 ;
enable | 是否开启; |
path | 虚拟背景本地图片路径,支持JPG,PNG 格式; |
model | 背景图缩放模式,裁剪或缩放;
|
AliRtcPluginErrorCode
;- (int) enableBackgroundBlur: | (BOOL) | enable | |
blurDegree: | (uint32_t) | blurDegree | |
开启/关闭虚拟背景虚化功能
需要集成虚拟背景插件,虚拟背景简介及下载详见官网组件文档 ; 需要下载及集成虚拟背景插件,背景替换与背景虚化不可同时使用,如开启虚拟背景开关后再次开启背景虚化,则只有背景虚化效果;
enable | 是否开启; |
blurDegree | 虚化程度 取值范围 [0-100]; |
AliRtcPluginErrorCode
;- (int) enablePlugin: | (NSString *_Nullable) | moduleName | |
pluginName: | (NSString *_Nullable) | pluginName | |
pluginType: | (int) | pluginType | |
opType: | (uint32_t) | opType | |
option: | (const void *_Nullable) | option | |
开启音视频处理算法插件
RTC采用插件件形式提供音视频增强及特效能力,可通过官网组件文档 进行组件下载,参考插件集成文档集成进RTC引擎;
moduleName | 插件库包名,组件文档中会有对应描述,包名中不包含插件后缀名如:iOS/Mac平台使用虚拟背景插件bokeh.framework,则包名为bokeh,Windows平台插件库名为:bokeh.dll,则moduleName 为bokeh; |
pluginName | 插件类名,根据下载的插件库中头文件中描述进行设置 如:虚拟背景插件头文件中描述了 pluginName 为 PluginBokeh; |
pluginType | 插件类型,值为AliRtcPluginDataType 与AliRtcPluginOperationType组合, 如:视频前处理插件 pluginType = (AliRtcPluginDataTypeVideo << 16)|AliRtcPluginPreOperation; 如果需要修改已开启插件的pluginType,需要先进行插件关闭,再次开启; |
opType | 插件初始化参数类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 插件初始化参数值,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
AliRtcPluginErrorCode
;由 category AliRtcEngine(Plugin) 提供.
- (int) enablePlugin: | (NSString *_Nullable) | moduleName | |
pluginName: | (NSString *_Nullable) | pluginName | |
pluginType: | (int) | pluginType | |
opType: | (uint32_t) | opType | |
option: | (const void *_Nullable) | option | |
开启音视频处理算法插件
RTC采用插件件形式提供音视频增强及特效能力,可通过官网组件文档 进行组件下载,参考插件集成文档集成进RTC引擎;
moduleName | 插件库包名,组件文档中会有对应描述,包名中不包含插件后缀名如:iOS/Mac平台使用虚拟背景插件bokeh.framework,则包名为bokeh,Windows平台插件库名为:bokeh.dll,则moduleName 为bokeh; |
pluginName | 插件类名,根据下载的插件库中头文件中描述进行设置 如:虚拟背景插件头文件中描述了 pluginName 为 PluginBokeh; |
pluginType | 插件类型,值为AliRtcPluginDataType 与AliRtcPluginOperationType组合, 如:视频前处理插件 pluginType = (AliRtcPluginDataTypeVideo << 16)|AliRtcPluginPreOperation; 如果需要修改已开启插件的pluginType,需要先进行插件关闭,再次开启; |
opType | 插件初始化参数类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 插件初始化参数值,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
AliRtcPluginErrorCode
;由 category AliRtcEngine(Plugin) 提供.
- (int) removePlugin: | (uint32_t) | pluginId |
关闭音视频处理算法插件
pluginId | 开启音视频处理算法插件接口调用成功后返回值; |
AliRtcPluginErrorCode
;由 category AliRtcEngine(Plugin) 提供.
- (int) removePlugin: | (uint32_t) | pluginId |
关闭音视频处理算法插件
pluginId | 开启音视频处理算法插件接口调用成功后返回值; |
AliRtcPluginErrorCode
;由 category AliRtcEngine(Plugin) 提供.
- (int) setPluginOption: | (uint32_t) | pluginId | |
opType: | (uint32_t) | opType | |
option: | (const void *_Nullable) | option | |
根据插件ID设置插件
pluginId | 插件开启接口调用成功后返回值; |
opType | 设置插件参数类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 设置插件参数值,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
AliRtcPluginErrorCode
;由 category AliRtcEngine(Plugin) 提供.
- (int) setPluginOption: | (uint32_t) | pluginId | |
opType: | (uint32_t) | opType | |
option: | (const void *_Nullable) | option | |
根据插件ID设置插件
pluginId | 插件开启接口调用成功后返回值; |
opType | 设置插件参数类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 设置插件参数值,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
AliRtcPluginErrorCode
;由 category AliRtcEngine(Plugin) 提供.
- (int) getPluginOption: | (uint32_t) | pluginId | |
opType: | (uint32_t) | opType | |
option: | (void *_Nonnull) | option | |
根据插件ID获取插件内部信息
pluginId | 开启插件接口调用成功后返回值; |
opType | 获取信息类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 返回的信息写入地址,插件会根据opType类型将返回的信息重写入option,需要进行内存初始化,长度请参考接入文档及插件头文件描述; |
AliRtcPluginErrorCode
;由 category AliRtcEngine(Plugin) 提供.
- (int) getPluginOption: | (uint32_t) | pluginId | |
opType: | (uint32_t) | opType | |
option: | (void *_Nonnull) | option | |
根据插件ID获取插件内部信息
pluginId | 开启插件接口调用成功后返回值; |
opType | 获取信息类型,请阅读插件库接入文档,参考各个插件头文件中描述进行设置; |
option | 返回的信息写入地址,插件会根据opType类型将返回的信息重写入option,需要进行内存初始化,长度请参考接入文档及插件头文件描述; |
AliRtcPluginErrorCode
;由 category AliRtcEngine(Plugin) 提供.