AlivcLivePusher v7.4.0
Aliyun Live Pusher API Reference Manual for iOS Platforms
Loading...
Searching...
No Matches
AlivcLivePusher Class Reference

#include "AlivcLivePusher.h"

Inheritance diagram for AlivcLivePusher:

Instance Methods

(int) - addDynamicWaterMarkImageDataWithPath:x:y:w:h:
 添加动态贴纸,最多支持添加5个贴纸
 
(int) - addExternalAudioStream:
 新增外部音频流
 
(int) - addMixAudio:format:audioSample:
 添加音频混流设置
 
(int) - addMixVideo:width:height:rotation:displayX:displayY:displayW:displayH:adjustHeight:
 添加视频混流设置
 
(int) - addWatermarkWithPath:watermarkCoordX:watermarkCoordY:watermarkWidth:
 添加水印 最多支持3个水印
 
(void) - changeMixVideoPosition:displayX:displayY:displayW:displayH:
 改变视频混流位置
 
(void) - destory
 销毁推流引擎
 
(int) - enableAudioFrameObserver:audioSource:config:
 设置音频回调参数
 
(int) - enableAudioVolumeIndication:smooth:reportVad:
 设置音量回调频率和平滑系数
 
(int) - enableLocalCamera:
 禁用或启用本地视频采集(非互动模式暂不支持该API,调用无任何效果)
 
(int) - enableSEIVideoStream:
 开启SEI视频流,内部将使用16x16全黑图片流/20fps
 
(int) - enableSpeakerphone:
 设置音频输出为听筒还是扬声器
 
(int) - focusCameraAtAdjustedPoint:autoFocus:
 对焦
 
(int) - getAudioEffectPlayoutVolumeWithSoundId:
 获取音效本地播放音量
 
(int) - getAudioEffectPublishVolumeWithSoundId:
 获取音效推流混音音量
 
(int) - getBGMCurrentPosition
 获取伴奏文件播放进度,单位为毫秒
 
(int) - getBGMDuration
 获取伴奏文件时长, 单位为毫秒
 
(AlivcLiveVideoCodecManufacturer) - getCurrentEncoderManufacturer:
 获取当前使用的编码器类型,如未开始推流,返回无效类型
 
(float) - getCurrentExposure
 获取当前曝光度
 
(float) - getCurrentZoom
 获取当前变焦值
 
(AlivcLivePushStatsInfo *) - getLivePushStatusInfo
 获取推流数据统计
 
(AlivcLivePushStatus) - getLiveStatus
 获取当前推流状态
 
(float) - getMaxZoom
 获取支持的最大变焦值
 
(NSString *) - getParameter:
 获取自定义参数
 
(NSString *) - getPushURL
 获取当前推流URL
 
(float) - getSupportedMaxExposure
 获取支持最大曝光度
 
(float) - getSupportedMinExposure
 获取支持最小曝光度
 
(AlivcLivePushVideoEncoderModeHardCodec) - getVideoCodecType
 获取当前视频编码格式
 
(instancetype) - initWithConfig:
 创建一个推流引擎实例
 
(bool) - inputMixAudioData:data:size:pts:
 输入音频混流数据
 
(void) - inputMixVideoData:data:width:height:stride:size:pts:rotation:
 输入视频混流数据
 
(BOOL) - isCameraAutoFocusFaceModeSupported
 摄像头是否支持人脸聚焦
 
(BOOL) - isEnableSpeakerphone
 获取当前音频输出为听筒还是扬声器
 
(BOOL) - isPushing
 获取是否正在推流
 
(int) - muteLocalCamera:
 关闭/打开视频(非互动模式暂不支持该API,调用无任何效果)
 
(int) - pause
 暂停摄像头推流,如果pushCongfig 中设置了pauseImg图片,将推设置的静态图片
 
(int) - pauseAllAudioEffects
 暂停所有音效
 
(int) - pauseAudioEffectWithSoundId:
 暂停音效
 
(int) - pauseBGM
 暂停播放背景音乐
 
(int) - playAudioEffectWithSoundId:filePath:config:
 开始播放音效
 
(int) - preloadAudioEffectWithSoundId:filePath:
 预加载音效文件
 
(int) - pushExternalAudioStream:rawData:
 输入外部音频流数据
 
(int) - pushExternalVideoFrame:sourceType:
 输入视频数据
 
(int) - reconnectPushAsync
 重连 异步接口
 
(int) - reconnectPushAsync:
 推流URL的重连 异步接口
 
(int) - refreshPushURLToken:
 刷新Token鉴权信息,传入一个新的推流URL,包含未过期的新token信息,房间ID/用户ID/sdkAppId需要和之前保持一样
 
(void) - registerVideoSampleObserver
 订阅视频数据
 
(void) - removeDynamicWaterMark:
 删除动态贴纸
 
(int) - removeExternalAudioStream:
 删除外部音频流
 
(void) - removeMixAudio:
 移除音频混流
 
(void) - removeMixVideo:
 移除视频混流设置
 
(int) - restartPush
 重新推流 同步接口
 
(int) - restartPushAsync
 重新推流 异步接口
 
(int) - resume
 恢复摄像头推流 同步接口
 
(int) - resumeAllAudioEffects
 恢复所有音效文件
 
(int) - resumeAsync
 恢复推流 异步接口
 
(int) - resumeAudioEffectWithSoundId:
 恢复指定音效文件
 
(int) - resumeBGM
 恢复播放背景音乐
 
(void) - sendAudioSampleBuffer:withType:
 发送自定义的audio SampleBuffer
 
(int) - sendDataChannelMessage:
 通过数据通道发送自定义消息
 
(int) - sendMessage:repeatCount:delayTime:KeyFrameOnly:
 设置自定义Message (SEI)
 
(int) - sendMessage:repeatCount:delayTime:KeyFrameOnly:payloadType:
 设置自定义Message (SEI)
 
(void) - sendPCMData:size:sampleRate:channel:pts:
 发送自定义音频数据
 
(void) - sendVideoData:width:height:size:pts:rotation:
 发送自定义视频数据
 
(void) - sendVideoSampleBuffer:
 发送自定义video SampleBuffer
 
(int) - setAllAudioEffectsPlayoutVolume:
 设置所有音效本地播音量
 
(int) - setAllAudioEffectsPublishVolume:
 设置所有音效推流混音音量
 
(int) - setAudioDenoise:
 设置降噪开关
 
(int) - setAudioEffectBeautifyMode:
 设置美声音效模式
 
(int) - setAudioEffectEqualizationParam:gain:
 设置均衡器参数
 
(int) - setAudioEffectPitchValue:
 设置变调参数
 
(int) - setAudioEffectPlayoutVolumeWithSoundId:volume:
 设置音效本地播放音量
 
(int) - setAudioEffectPublishVolumeWithSoundId:volume:
 设置音效推流混音音量
 
(int) - setAudioEffectReverbMode:
 设置混响音效模式
 
(int) - setAudioEffectReverbParamType:value:
 设置混响音效类型
 
(int) - setAudioEffectVoiceChangeMode:
 设置变声音效模式
 
(int) - setAudioProfile:
 设置音频profile
 
(void) - setAudioSampleDelegate:
 设置音频裸数据回调
 
(int) - setAutoFocus:
 设置自动对焦
 
(void) - setBGMDelegate:
 设置背景音乐监听回调
 
(int) - setBGMEarsBack:
 设置背景音乐耳返开关
 
(int) - setBGMLoop:
 设置背景音乐是否循环播放
 
(int) - setBGMVolume:
 设置背景音乐混音 音乐音量
 
(BOOL) - setCameraAutoFocusFaceModeEnabled:
 设置摄像头人脸对焦
 
(int) - setCaptureVolume:
 设置背景音乐混音 人声音量
 
(int) - setChannelProfile:
 设置频道模式
 
(void) - setCustomDetectorDelegate:
 设置用户自定义人脸识别回调
 
(void) - setCustomFilterDelegate:
 设置用户自定义滤镜回调
 
(int) - setCustomVideoResolution:
 设置视频自定义分辨率(直播连麦场景可用,基础直播不可用)
 
(void) - setErrorDelegate:
 设置推流错误监听回调
 
(int) - setExposure:
 设置曝光度
 
(int) - setExternalAudioSource:withSampleRate:channelsPerFrame:
 设置是否启用外部音频输入源
 
(int) - setExternalAudioStream:playoutVolume:
 设置外部音频流播放音量
 
(int) - setExternalAudioStream:publishVolume:
 设置外部音频流推流音量
 
(int) - setExternalVideoSource:sourceType:renderMode:
 启用外部视频输入源
 
(int) - setFlash:
 闪光灯开关
 
(void) - setInfoDelegate:
 设置推流状态监听回调
 
(int) - setLiveMixTranscodingConfig:
 设置云端的混流(转码)参数 一个直播间中可能有不止一位主播,而且每个主播都有自己的画面和声音,但对于 CDN 观众来说,他们只需要一路直播流 所以您需要将多路音视频流混成一路标准的直播流,这就需要混流转码 在连麦场景下,需要将主播和连麦观众音视频流混成一路标准的直播流,供CDN观众观看 在PK场景下,需要将进行PK的多个主播的音视频流混成一路标准的直播流,供CDN观众观看
 
(int) - setLogLevel:
 设置Log级别
 
(int) - setLogPath:maxPartFileSizeInKB:
 设置Log路径
 
(int) - setMinVideoBitrate:
 设置最小码率
 
(int) - setMixedWithMic:
 设置是否与麦克风采集音频混合
 
(void) - setMixVideoMirror:isMirror:
 改变视频混流镜像
 
(void) - setMute:
 静音推流
 
(void) - setMute:mode:
 停止/恢复本地音频数据发送
 
(void) - setNetworkDelegate:
 设置推流网络监听回调
 
(int) - setParameter:
 设置自定义参数
 
(void) - setpreviewDisplayMode:
 设置预览显示模式
 
(void) - setPreviewMirror:
 预览镜像开关
 
(void) - setPushMirror:
 推流镜像开关
 
(int) - setQualityMode:
 设置推流模式
 
(void) - setResolution:
 设置推流分辨率
 
(void) - setSnapshotDelegate:
 设置截图回调
 
(int) - setTargetVideoBitrate:
 设置目标码率
 
(void) - setVideoEncoderConfiguration:
 设置相机流视频编码属性
 
(int) - setVideoMirrorMode:
 设置预览和推流镜像能力
 
(void) - setWatermark:rect:
 添加水印(互动模式下使用该接口添加水印)
 
(void) - setWatermarkVisible:
 设置水印显示和隐藏
 
(int) - setZoom:
 缩放
 
(void) - snapshot:interval:
 截图
 
(void) - startAudioCapture:
 开启音频采集
 
(void) - startAudioPlayer
 开启音频播放
 
(int) - startBGMWithMusicPathAsync:
 播放背景音乐
 
(int) - startBGMWithMusicPathAsync:config:
 播放背景音乐
 
(int) - startIntelligentDenoise
 开启智能降噪
 
(int) - startLastmileDetect:
 开始网络质量探测
 
(int) - startLocalDualAudioStream
 开启第二路音频流推送
 
(int) - startPreview:
 开始预览 同步接口
 
(int) - startPreviewAsync:
 开始预览 异步接口
 
(int) - startPushWithURL:
 开始推流 同步接口
 
(int) - startPushWithURLAsync:
 开始推流 异步接口
 
(BOOL) - startRecording:
 开启本地音视频流录制
 
(int) - startScreenCapture:
 开始屏幕分享(该接口支持 iOS 11.0 及以上的 iPhone 和 iPad)。
 
(int) - startScreenShare
 启动屏幕分享
 
(int) - stopAllAudioEffects
 停止播放所有音效
 
(void) - stopAudioCapture
 关闭音频采集
 
(int) - stopAudioEffectWithSoundId:
 停止播放音效
 
(void) - stopAudioPlayer
 关闭音频播放
 
(int) - stopBGMAsync
 停止播放背景音乐
 
(int) - stopIntelligentDenoise
 关闭智能降噪
 
(int) - stopLastmileDetect
 停止网络质量探测
 
(int) - stopLocalDualAudioStream
 停止第二路音频流推送
 
(int) - stopPreview
 停止预览
 
(int) - stopPush
 停止推流
 
(void) - stopRecording
 停止本地音视频流录制
 
(int) - stopScreenShare
 停止屏幕分享
 
(int) - switchCamera
 切换摄像头
 
(int) - unloadAudioEffectWithSoundId:
 删除预加载的音效文件
 
(void) - unregisterVideoSampleObserver
 取消订阅视频数据,调用后onProcessVideoSampleBuffer不回回调
 
(void) - updateLocalView:
 更新本地摄像头的预览画面
 

Class Methods

("Use AlivcLiveBase->getSDKVersion instead.") + __deprecated_msg
 获取SDK版本号
 
(void) + hideDebugView
 隐藏调试悬浮窗(已废弃)
 
(void) + showDebugView
 显示调试悬浮窗(已废弃)
 

Method Documentation

◆ __deprecated_msg

+ ("Use AlivcLiveBase->getSDKVersion instead.") __deprecated_msg

获取SDK版本号

Returns
版本号

◆ addDynamicWaterMarkImageDataWithPath:x:y:w:h:

- (int) addDynamicWaterMarkImageDataWithPath: (NSString *) waterMarkDirPath
x: (float) x
y: (float) y
w: (float) w
h: (float) h 

添加动态贴纸,最多支持添加5个贴纸

Parameters
waterMarkDirPath:贴纸图片sequence目录
显示屏幕x位置(0~1.0f)
显示屏幕y位置(0~1.0f)
显示屏幕宽
显示屏幕高
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下添加动态贴纸,AlivcLivePushInteractiveMode模式下暂时不支持添加动态贴纸
Returns
返回动态贴纸的id号,删除贴纸传此id

◆ addExternalAudioStream:

- (int) addExternalAudioStream: (AliLiveExternalAudioStreamConfig *_Nonnull) config

新增外部音频流

Parameters
config外部音频流配置
Returns
  • <=0: 表示失败;
  • >0: 表示成功;
  • 返回值为 外部音频流Id
Note
通过pushExternalAudioStream接口向SDK 输入自定义数据

◆ addMixAudio:format:audioSample:

- (int) addMixAudio: (int) channels
format: (int) format
audioSample: (int) audioSample 

添加音频混流设置

Parameters
channels声道数
format音频格式 AlivcLivePushAudioFormat
audioSample音频采样率
Returns
返回对应音频混流标识ID 注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下添加音频混流,AlivcLivePushInteractiveMode模式下暂时不支持添加音频混流

◆ addMixVideo:width:height:rotation:displayX:displayY:displayW:displayH:adjustHeight:

- (int) addMixVideo: (int) format
width: (int) width
height: (int) height
rotation: (int) rotation
displayX: (float) displayX
displayY: (float) displayY
displayW: (float) displayW
displayH: (float) displayH
adjustHeight: (bool) adjustHeight 

添加视频混流设置

Parameters
format原始视频数据格式
width图像宽
height图像高
rotation图像角度
displayX图像要放置到屏幕的左上角坐标x
displayY图像要放置到屏幕的左上角坐标y
displayW图像显示的宽度
displayH图像显示的高度
adjustHeight图像自适应的高度
Returns
返回对应视频混流标识ID
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下添加视频混流设置,AlivcLivePushInteractiveMode模式下暂时不支持添加视频混流设置

◆ addWatermarkWithPath:watermarkCoordX:watermarkCoordY:watermarkWidth:

- (int) addWatermarkWithPath: (NSString *) path
watermarkCoordX: (CGFloat) coordX
watermarkCoordY: (CGFloat) coordY
watermarkWidth: (CGFloat) width 

添加水印 最多支持3个水印

Parameters
path水印路径
coordX水印左上顶点x的相对坐标 [0,1]
coordY水印左上顶点y的相对坐标 [0,1]
width水印的相对宽度 (水印会根据水印图片实际大小和水印宽度等比缩放) (0,1]
Returns
0:success 非0:failure
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下添加水印,AlivcLivePushInteractiveMode模式下使用setWatermark添加水印

◆ changeMixVideoPosition:displayX:displayY:displayW:displayH:

- (void) changeMixVideoPosition: (int) handler
displayX: (float) displayX
displayY: (float) displayY
displayW: (float) displayW
displayH: (float) displayH 

改变视频混流位置

Parameters
handler视频混流标识ID,通过addMixVideo接口获得
displayX图像要放置到屏幕的左上角坐标x
displayY图像要放置到屏幕的左上角坐标y
displayW图像显示的宽度
displayH图像显示的高度
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下改变视频混流位置,AlivcLivePushInteractiveMode模式下暂时不支持改变视频混流位置

◆ destory

- (void) destory

销毁推流引擎

◆ enableAudioFrameObserver:audioSource:config:

- (int) enableAudioFrameObserver: (bool) enable
audioSource: (AliLiveAudioSource) audioSource
config: (AliLiveAudioFrameObserverConfig *_Nullable) config 

设置音频回调参数

Parameters
enable是否允许数据回调
audioSource回调数据源类型,详见 AliLiveAudioSource
config回调参数设置,详见AliLiveAudioFrameObserverConfig, null时默认参数为48000,1,ReadOnly
  • AliLiveAudioSourcePub、AliLiveAudioSourceMixedAll只支持ReadOnly模式
  • AliLiveAudioSourceRemoteUser不支持修改采样率、通道数
    Returns
    0: sucess

◆ enableAudioVolumeIndication:smooth:reportVad:

- (int) enableAudioVolumeIndication: (int) interval
smooth: (int) smooth
reportVad: (int) reportVad 

设置音量回调频率和平滑系数

Parameters
interval时间间隔,单位毫秒,最小值不得小于10ms, 建议设置300-500ms, <= 0表示不启用音量提示和说话人提示功能
smooth平滑系数,数值越大平滑程度越高,反之越低,实时性越好,建议设置3,范围[0, 9];
reportVad说话人检测开关
  • 1: 打开本地人声检测
  • 0: 关闭本地人声检测
Returns
  • 0: 成功
  • <0: 失败
Note
设置之后,音频音量和说话人uid会分别通过 AlivcLivePusherInfoDelegate::onMicrophoneVolumeUpdate:volume:回调
可以通过调用该接口及相关回调,可以实现声音波纹效果

◆ enableLocalCamera:

- (int) enableLocalCamera: (BOOL) enabled

禁用或启用本地视频采集(非互动模式暂不支持该API,调用无任何效果)

Parameters
enabled
  • YES : 启用本地视频采集
  • NO : 禁用本地视频采集
Returns
  • 0 : 成功
  • < 0 : 失败
Note
摄像头采集会被关闭掉

◆ enableSEIVideoStream:

- (int) enableSEIVideoStream: (bool) enable

开启SEI视频流,内部将使用16x16全黑图片流/20fps

Note
在互动模式下,如果把摄像头采集关闭(调用enableLocalCamera接口),纯音频场景,默认不会发送视频, 但是如果后续调用了sendMessage接口发送SEI信息,SDK内部默认会发送16x16全黑图片流/20fps的视频流来承载SEI信息, 可以通过调用enableSEIVideoStream来关闭SDK默认的推送16x16全黑图片逻辑,关闭后纯音频场景将发送不了SEI信息
Parameters
enabletrue=开启 false=关闭
Returns
  • 0: 成功
  • 非0: 失败

◆ enableSpeakerphone:

- (int) enableSpeakerphone: (BOOL) enable

设置音频输出为听筒还是扬声器

Parameters
enable
  • YES: 扬声器模式(默认)
  • NO: 听筒模式
Returns
  • 0: 成功
  • <0: 失败

◆ focusCameraAtAdjustedPoint:autoFocus:

- (int) focusCameraAtAdjustedPoint: (CGPoint) point
autoFocus: (bool) autoFocus 

对焦

Parameters
point对焦的点,point.x和point.y的取值是(0,1),表示当前点相对于渲染view的相对位置
autoFocus是否自动对焦
Returns
0:success 非0:failure

◆ getAudioEffectPlayoutVolumeWithSoundId:

- (int) getAudioEffectPlayoutVolumeWithSoundId: (NSInteger) soundId

获取音效本地播放音量

Parameters
soundId用户给该音效文件分配的ID
Returns
  • [0, 100]:音效本地播放音量
  • 其他:错误值
Note
音效本地播放音量有效范围为:[0, 100],该方法需要在 playAudioEffectWithSoundId:filePath:cycles:publish: 后调用

◆ getAudioEffectPublishVolumeWithSoundId:

- (int) getAudioEffectPublishVolumeWithSoundId: (NSInteger) soundId

获取音效推流混音音量

Parameters
soundId用户给该音效文件分配的ID
Returns
  • [0, 100]:音效推流混音音量
  • 其他:错误值
Note
音效推流混音音量有效范围为:[0, 100],该方法需要在 playAudioEffectWithSoundId:filePath:config: 后调用

◆ getBGMCurrentPosition

- (int) getBGMCurrentPosition

获取伴奏文件播放进度,单位为毫秒

Returns
  • >=0: 伴奏文件播放进度
  • <0: 返回错误码

◆ getBGMDuration

- (int) getBGMDuration

获取伴奏文件时长, 单位为毫秒

Returns
  • >=0: 伴奏文件时长
  • <0: 返回错误码

◆ getCurrentEncoderManufacturer:

- (AlivcLiveVideoCodecManufacturer) getCurrentEncoderManufacturer: (BOOL) isCameraStreem

获取当前使用的编码器类型,如未开始推流,返回无效类型

Parameters
isCameraStreemYES: 获取摄像头流的编码器类型; NO: 获取共享流的编码器类型
Returns
AlivcLiveVideoCodecManufacturer 编码器类型

◆ getCurrentExposure

- (float) getCurrentExposure

获取当前曝光度

Returns
曝光度

◆ getCurrentZoom

- (float) getCurrentZoom

获取当前变焦值

Returns
当前变焦值

◆ getLivePushStatusInfo

- (AlivcLivePushStatsInfo *) getLivePushStatusInfo

获取推流数据统计

Returns
推流数据 AlivcLivePushStatsInfo

◆ getLiveStatus

- (AlivcLivePushStatus) getLiveStatus

获取当前推流状态

Returns
推流状态 AlivcLivePushStatus

◆ getMaxZoom

- (float) getMaxZoom

获取支持的最大变焦值

Returns
最大变焦值

◆ getParameter:

- (NSString *) getParameter: (NSString *) param

获取自定义参数

Parameters
param自定义参数
Returns
自定义参数值

◆ getPushURL

- (NSString *) getPushURL

获取当前推流URL

Returns
推流URL

◆ getSupportedMaxExposure

- (float) getSupportedMaxExposure

获取支持最大曝光度

Returns
最大曝光度

◆ getSupportedMinExposure

- (float) getSupportedMinExposure

获取支持最小曝光度

Returns
最小曝光度

◆ getVideoCodecType

- (AlivcLivePushVideoEncoderModeHardCodec) getVideoCodecType

获取当前视频编码格式

Returns
  • AlivcLivePushVideoEncoderModeHardCodecH264: H264
  • AlivcLivePushVideoEncoderModeHardCodecHEVC: HEVC

◆ hideDebugView

+ (void) hideDebugView

隐藏调试悬浮窗(已废弃)

Note
已废弃使用
Deprecated

◆ initWithConfig:

- (instancetype) initWithConfig: (AlivcLivePushConfig *) config

创建一个推流引擎实例

Parameters
config推流配置信息 AlivcLivePushConfig
Returns
self:success nil:failure
Note
同一时间只会存在一个主推流引擎实例,引擎销毁对应的接口:AlivcLivePusher::destory

◆ inputMixAudioData:data:size:pts:

- (bool) inputMixAudioData: (int) handler
data: (long) dataptr
size: (int) size
pts: (long) pts 

输入音频混流数据

Parameters
handler音频混流标识ID,通过addMixAudio接口获得
dataptr数据buffer的地址
size音频数据的大小
pts时间戳(单位微秒)
Returns
success:true, failed:false
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下输入音频混流数据,AlivcLivePushInteractiveMode模式下暂时不支持输入音频混流数据

◆ inputMixVideoData:data:width:height:stride:size:pts:rotation:

- (void) inputMixVideoData: (int) handler
data: (long) dataptr
width: (int) width
height: (int) height
stride: (int) stride
size: (int) size
pts: (long) pts
rotation: (int) rotation 

输入视频混流数据

Parameters
handler视频混流标识ID,通过addMixVideo接口获得
dataptr数据buffer的地址
width图像宽
height图像高
stride图像存储时内存中每行像素所占用的空间
size此帧图像的大小
pts时间戳(单位微秒)
rotation图像角度
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下输入视频混流数据,AlivcLivePushInteractiveMode模式下暂时不支持输入视频混流数据

◆ isCameraAutoFocusFaceModeSupported

- (BOOL) isCameraAutoFocusFaceModeSupported

摄像头是否支持人脸聚焦

Returns
  • YES: 支持
  • NO: 不支持
Note
在camera没有打开的情况下返回 NO, 在camera打开的情况下,如果当前camera同时支持人脸识别和对焦功能则返回 YES

◆ isEnableSpeakerphone

- (BOOL) isEnableSpeakerphone

获取当前音频输出为听筒还是扬声器

Returns
  • YES: 扬声器模式;
  • NO: 听筒模式

◆ isPushing

- (BOOL) isPushing

获取是否正在推流

Returns
YES:正在推流 NO:未推流
Note
可以用该方法判断是否在推流

◆ muteLocalCamera:

- (int) muteLocalCamera: (BOOL) mute

关闭/打开视频(非互动模式暂不支持该API,调用无任何效果)

Parameters
muteYES表示不发送视频数据;NO表示恢复正常
Returns
  • 0: 表示Success
  • 非0: 表示Failure
Note
发送黑色的视频帧。采集,编码,发送模块仍然工作,只是视频内容是黑色帧

◆ pause

- (int) pause

暂停摄像头推流,如果pushCongfig 中设置了pauseImg图片,将推设置的静态图片

Returns
0:success 非0:failure
Note
SDK不提供暂停推流的接口,这个接口的含义是暂停摄像头推流切换成推静态图片,只是视频画面发生了变化,声音还是推流

◆ pauseAllAudioEffects

- (int) pauseAllAudioEffects

暂停所有音效

Returns
  • 0:成功
  • 非0:失败

◆ pauseAudioEffectWithSoundId:

- (int) pauseAudioEffectWithSoundId: (NSInteger) soundId

暂停音效

Parameters
soundId用户给该音效文件分配的ID
Returns
  • 0:成功
  • 非0:失败

◆ pauseBGM

- (int) pauseBGM

暂停播放背景音乐

Returns
0:success 非0:failure

◆ playAudioEffectWithSoundId:filePath:config:

- (int) playAudioEffectWithSoundId: (NSInteger) soundId
filePath: (NSString *_Nonnull) filePath
config: (AliLiveAudioEffectConfig *_Nonnull) config 

开始播放音效

开始播放音效接口,可以多次调用该方法传入不同的soundId和filePath,同时播放多个音效文件,音效文件播放结束后,SDK 会触发 onAudioEffectFinished: 回调

Parameters
soundId用户给该音效文件分配的ID,每个音效均有唯一的ID,如果你已通过 preloadAudioEffectWithSoundId:filePath: 将音效加载至内存,确保这里的soundId与 preloadAudioEffectWithSoundId:filePath: 设置的soundId相同
filePath文件路径,支持本地文件和网络url
config音效播放配置,详见AliLiveAudioEffectConfig
Returns
  • 0:成功
  • 非0:失败

◆ preloadAudioEffectWithSoundId:filePath:

- (int) preloadAudioEffectWithSoundId: (NSInteger) soundId
filePath: (NSString *_Nonnull) filePath 

预加载音效文件

Parameters
soundId用户给该音效文件分配的ID
filePath音效文件路径,支持本地文件和网络url
Returns
  • 0:成功
  • 非0:失败
Note
音效相关接口为同步接口, 建议使用本地文件

◆ pushExternalAudioStream:rawData:

- (int) pushExternalAudioStream: (int) streamId
rawData: (AlivcLivePusherAudioDataSample *_Nonnull) audioFrame 

输入外部音频流数据

Parameters
streamId外部音频流Id(addExternalAudioStream的返回值)
audioFrame音频数据
Returns
  • <0: 表示失败;
  • 0: 表示成功;
  • 返回值为0x01070101 时,需要在间隔投递数据时间长度后再次重试投递
Note
为了保证语音连续性,sdk内部会有buffer缓存送进来的音频数据,以每次送10ms数据为例,如果返回 0x01070101 时,说明内部缓冲区已满,建议等待20ms后再重新送当前数据帧;

◆ pushExternalVideoFrame:sourceType:

- (int) pushExternalVideoFrame: (AlivcLiveVideoDataSample *_Nonnull) frame
sourceType: (AliLiveVideoSource) type 

输入视频数据

Parameters
frame帧数据,详见 AlivcLiveVideoDataSample
type流类型,详见 AliLiveVideoSource
  • AliLiveVideosourceCameraType 外部输入视频数据走相机流通道
  • AliLiveVideosourceScreenShareType 外部输入视频数据走屏幕流通道
Returns
  • 0: 成功
  • 非0: 失败
Note
如果返回值为0x01070102,代表当前buffer队列塞满,需要等待后再继续输送数据

◆ reconnectPushAsync

- (int) reconnectPushAsync

重连 异步接口

Returns
0:success 非0:failure

◆ reconnectPushAsync:

- (int) reconnectPushAsync: (NSString *) pushURL

推流URL的重连 异步接口

Returns
0:success 非0:failure

◆ refreshPushURLToken:

- (int) refreshPushURLToken: (NSString *_Nonnull) pushUrl

刷新Token鉴权信息,传入一个新的推流URL,包含未过期的新token信息,房间ID/用户ID/sdkAppId需要和之前保持一样

该方法用于更新鉴权信息推流URL中的token信息,主要为了防止鉴权过期,导致推流失败,当我们收到 onPushURLTokenWillExpire 回调时,应用应当更新鉴权信息

Parameters
pushURL推流URL
Returns
  • 0: 成功
  • <0: 失败

◆ registerVideoSampleObserver

- (void) registerVideoSampleObserver

订阅视频数据

◆ removeDynamicWaterMark:

- (void) removeDynamicWaterMark: (int) vid

删除动态贴纸

Parameters
vid:贴纸id,addDynamicWaterMarkImageDataWithPath时返回

◆ removeExternalAudioStream:

- (int) removeExternalAudioStream: (int) streamId

删除外部音频流

Parameters
streamId外部音频流Id
Returns
  • <0: 表示失败;
  • 0: 表示成功;

◆ removeMixAudio:

- (void) removeMixAudio: (int) handler

移除音频混流

Parameters
handler音频混流标识ID,通过addMixAudio接口获得
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下移除音频混流,AlivcLivePushInteractiveMode模式下暂时不支持移除音频混流

◆ removeMixVideo:

- (void) removeMixVideo: (int) handler

移除视频混流设置

Parameters
handler视频混流标识ID,通过addMixVideo接口获得

◆ restartPush

- (int) restartPush

重新推流 同步接口

Returns
0:success 非0:failure
Note
此接口SDK内部会停止预览再开启预览,预览画面会有黑一下的过程;如果不希望重新预览,仅是重新推流,可以先调用stopPush结束推流,再调用startPushWithURL开启推流

◆ restartPushAsync

- (int) restartPushAsync

重新推流 异步接口

Returns
0:success 非0:failure
Note
此接口SDK内部会停止预览再开启预览,预览画面会有黑一下的过程;如果不希望重新预览,仅是重新推流,可以先调用stopPush结束推流,再调用startPushWithURLAsync开启推流

◆ resume

- (int) resume

恢复摄像头推流 同步接口

Returns
0:success 非0:failure

◆ resumeAllAudioEffects

- (int) resumeAllAudioEffects

恢复所有音效文件

Returns
  • 0:成功
  • 非0:失败

◆ resumeAsync

- (int) resumeAsync

恢复推流 异步接口

Returns
0:success 非0:failure

◆ resumeAudioEffectWithSoundId:

- (int) resumeAudioEffectWithSoundId: (NSInteger) soundId

恢复指定音效文件

Parameters
soundId用户给该音效文件分配的ID
Returns
  • 0:成功
  • 非0:失败

◆ resumeBGM

- (int) resumeBGM

恢复播放背景音乐

Returns
0:success 非0:failure

◆ sendAudioSampleBuffer:withType:

- (void) sendAudioSampleBuffer: (CMSampleBufferRef) sampleBuffer
withType: (RPSampleBufferType) sampleBufferType 

发送自定义的audio SampleBuffer

只限于replaykit录屏直播使用

Parameters
sampleBufferaudio sample buffer
sampleBufferTypeaudio sample buffer type
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下发送自定义的audio SampleBuffer,AlivcLivePushInteractiveMode模式下暂时不支持发送自定义的audio SampleBuffer,请使用sendPCMData接口向SDK输入自定义音频数据

◆ sendDataChannelMessage:

- (int) sendDataChannelMessage: (NSString *) message

通过数据通道发送自定义消息

Parameters
message自定义消息
Returns
  • 0: 成功
  • 非0: 失败

◆ sendMessage:repeatCount:delayTime:KeyFrameOnly:

- (int) sendMessage: (NSString *) msg
repeatCount: (int) count
delayTime: (int) time
KeyFrameOnly: (bool) isKeyFrame 

设置自定义Message (SEI)

Parameters
msg用户推流消息
count重复次数
time延时时间,单位毫秒
isKeyFrame是否只发关键帧,该参数只支持在livePushMode = AlivcLivePushBasicMode 模式下设置,AlivcLivePushInteractiveMode模式下暂时不支持设置,互动模式下传入false
Returns
0:success 非0:failure
Note
该接口sei 的payloadType为5

◆ sendMessage:repeatCount:delayTime:KeyFrameOnly:payloadType:

- (int) sendMessage: (NSString *) msg
repeatCount: (int) count
delayTime: (int) time
KeyFrameOnly: (bool) isKeyFrame
payloadType: (int) payloadType 

设置自定义Message (SEI)

Parameters
msg用户推流消息
count重复次数
time延时时间,单位毫秒
isKeyFrame是否只发关键帧,该参数只支持在livePushMode = AlivcLivePushBasicMode 模式下设置,AlivcLivePushInteractiveMode模式下暂时不支持设置, ,互动模式下传入false
payloadType类型,可设置的值为5或者[100..254]范围区间,如果设置5,则在内容前面会有一个16字节的UUID
Returns
0:success 非0:failure
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushInteractiveMode 模式下生效,AlivcLivePushBasicMode模式下暂时不支持设置payloadType

◆ sendPCMData:size:sampleRate:channel:pts:

- (void) sendPCMData: (char *) data
size: (int) size
sampleRate: (int) sampleRate
channel: (int) channel
pts: (uint64_t) pts 

发送自定义音频数据

Parameters
data音频数据
size数据大小
sampleRate采样率
channel声道数
pts时间戳(单位微秒)

◆ sendVideoData:width:height:size:pts:rotation:

- (void) sendVideoData: (char *) data
width: (int) width
height: (int) height
size: (int) size
pts: (uint64_t) pts
rotation: (int) rotation 

发送自定义视频数据

Parameters
data视频数据
width视频宽度
height视频高度
size数据大小
pts时间戳(单位微秒)
rotation旋转

◆ sendVideoSampleBuffer:

- (void) sendVideoSampleBuffer: (CMSampleBufferRef) sampleBuffer

发送自定义video SampleBuffer

Parameters
sampleBuffervideo sample buffer
Note
当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下发送自定义video SampleBuffer,AlivcLivePushInteractiveMode模式下请使用sendVideoData接口向SDK输入自定义视频数据

◆ setAllAudioEffectsPlayoutVolume:

- (int) setAllAudioEffectsPlayoutVolume: (NSInteger) volume

设置所有音效本地播音量

Parameters
volume音效本地播放音量,范围:[0, 100],默认值:50
Returns
  • 0:成功
  • 非0:失败

◆ setAllAudioEffectsPublishVolume:

- (int) setAllAudioEffectsPublishVolume: (NSInteger) volume

设置所有音效推流混音音量

Parameters
volume推流混音音量,范围是:[0, 100],默认值:50
Returns
  • 0:成功
  • 非0:失败

◆ setAudioDenoise:

- (int) setAudioDenoise: (bool) isOpen

设置降噪开关

Parameters
isOpen是否打开降噪 true:开启 false:关闭 默认:true
Returns
0:success 非0:failure

◆ setAudioEffectBeautifyMode:

- (int) setAudioEffectBeautifyMode: (AliLiveAudioEffectBeautifyMode) mode

设置美声音效模式

Parameters
mode参考 AliLiveAudioEffectBeautifyMode 对应的美声模式
Returns
  • 0:成功
  • 非0:失败

◆ setAudioEffectEqualizationParam:gain:

- (int) setAudioEffectEqualizationParam: (AliLiveAudioEffectEqualizationBandFrequency) bandIndex
gain: (float) gain 

设置均衡器参数

Parameters
bandIndex均衡器段数[0,9] center frequency [31,62,125,250,500,1000,2000,4000,8000,16000] Hz AliLiveAudioEffectEqualizationBandFrequency
gain均衡器增益db [-15,15] default 0
Returns
  • 0:成功
  • 非0:失败
Note
需要在 setAudioEffectBeautifyMode 之后调用

◆ setAudioEffectPitchValue:

- (int) setAudioEffectPitchValue: (double) value

设置变调参数

Parameters
value变调参数,范围:[0.5, 2.0],1.0表示音调不变,小于1.0表示音调降低,大于1.0表示音调升高,默认1.0
Returns
  • 0:成功
  • 非0:失败

◆ setAudioEffectPlayoutVolumeWithSoundId:volume:

- (int) setAudioEffectPlayoutVolumeWithSoundId: (NSInteger) soundId
volume: (NSInteger) volume 

设置音效本地播放音量

Parameters
soundId用户给该音效文件分配的ID
volume音效本地播放音量,范围:[0, 100],默认值:50
Returns
  • 0:成功
  • 非0:失败
Note
该方法需要在 playAudioEffectWithSoundId:filePath:cycles:publish: 后调用

◆ setAudioEffectPublishVolumeWithSoundId:volume:

- (int) setAudioEffectPublishVolumeWithSoundId: (NSInteger) soundId
volume: (NSInteger) volume 

设置音效推流混音音量

Parameters
soundId用户给该音效文件分配的ID
volume推流混音音量,范围是:[0, 100],默认值:50
Returns
  • 0:成功
  • 非0:失败
Note
该方法需要在 playAudioEffectWithSoundId:filePath:config: 后调用

◆ setAudioEffectReverbMode:

- (int) setAudioEffectReverbMode: (AlivcLivePushAudioEffectReverbMode) mode

设置混响音效模式

Parameters
mode参考AlivcLivePushAudioEffectReverbMode 对应的混响模式
Returns
  • 0:成功
  • 非0:失败
Note
推流前和推流过程中调用都生效

◆ setAudioEffectReverbParamType:value:

- (int) setAudioEffectReverbParamType: (AliLiveAudioEffectReverbParamType) type
value: (float) value 

设置混响音效类型

Parameters
type参考AliLiveAudioEffectReverbParamType 对应的混响类型
value混响参数值,不同混响类型的取值范围参考 AliLiveAudioEffectReverbParamType中取值说明
Returns
  • 0:成功
  • 非0:失败
Note
需要在 setAudioEffectReverbMode之后调用

◆ setAudioEffectVoiceChangeMode:

- (int) setAudioEffectVoiceChangeMode: (AlivcLivePushAudioEffectVoiceChangeMode) mode

设置变声音效模式

Parameters
mode参考AlivcLivePushAudioEffectVoiceChangerMode对应的变声音效模式值
Returns
  • 0:成功
  • 非0:失败
Note
推流前和推流过程中调用都生效

◆ setAudioProfile:

- (int) setAudioProfile: (AlivcLiveAudioProfile) audio_profile

设置音频profile

Parameters
audio_profile音频采集/编码模式参数, 详见AlivcLiveAudioProfile
Returns
  • 0: 成功
  • 其他: 失败
Note
只支持 startPushWithURL 前设置有效;

◆ setAudioSampleDelegate:

- (void) setAudioSampleDelegate: (id< AlivcLivePusherAudioSampleDelegate >) delegate

设置音频裸数据回调

Parameters
delegateAlivcLivePusherAudioSampleDelegate

◆ setAutoFocus:

- (int) setAutoFocus: (bool) autoFocus

设置自动对焦

Parameters
autoFocustrue:自动对焦 false:手动对焦
Returns
0:success 非0:failure
Note
SDK内部默认是自动对焦的

◆ setBGMDelegate:

- (void) setBGMDelegate: (id< AlivcLivePusherBGMDelegate >) delegate

设置背景音乐监听回调

Parameters
delegateAlivcLivePusherBGMDelegate

◆ setBGMEarsBack:

- (int) setBGMEarsBack: (bool) isOpen

设置背景音乐耳返开关

Parameters
isOpen是否打开耳返 true:开启耳返 false:关闭耳返
Returns
0:success 非0:failure

◆ setBGMLoop:

- (int) setBGMLoop: (bool) isLoop

设置背景音乐是否循环播放

Parameters
isLoop是否循环 true:循环 false:不循环
Returns
0:success 非0:failure

◆ setBGMVolume:

- (int) setBGMVolume: (int) volume

设置背景音乐混音 音乐音量

Parameters
volume音乐音量大小 范围:[0 ~ 100] 默认:50
Returns
0:success 非0:failure

◆ setCameraAutoFocusFaceModeEnabled:

- (BOOL) setCameraAutoFocusFaceModeEnabled: (BOOL) enable

设置摄像头人脸对焦

Parameters
enableYES: 开启; NO:关闭
Returns
  • YES: 成功
  • NO: 失败
Note
如果 isCameraAutoFocusFaceModeSupported 返回 YES 且此调用enable为 YES 的情况下,实时对焦到采集到数据的人脸上

◆ setCaptureVolume:

- (int) setCaptureVolume: (int) volume

设置背景音乐混音 人声音量

Parameters
volume人声音量大小 范围:[0 ~ 100] 默认:50
Returns
0:success 非0:failure

◆ setChannelProfile:

- (int) setChannelProfile: (AlivcLiveChannelProfile) profile

设置频道模式

根据业务需求可以配置不同的频道模式,AliRTC会根据不用的频道模式模式采用不用的策略,目前主要提供通信模式(默认)、互动模式、低延迟互动直播模式

Parameters
profile频道模式类型, 详细请参考 AlivcLiveChannelProfile
Returns
  • 0: 成功
  • 非0: 失败
Note
  • 该方法只在startPushWithURLAsync前调用有效,推流中不可以重新设置,stopPush 后可以重新设置

◆ setCustomDetectorDelegate:

- (void) setCustomDetectorDelegate: (id< AlivcLivePusherCustomDetectorDelegate >) delegate

设置用户自定义人脸识别回调

Parameters
delegateAlivcLivePusherCustomDetectorDelegate

◆ setCustomFilterDelegate:

- (void) setCustomFilterDelegate: (id< AlivcLivePusherCustomFilterDelegate >) delegate

设置用户自定义滤镜回调

Parameters
delegateAlivcLivePusherCustomFilterDelegate
Note
对接美颜SDK相关回调可参考: https://help.aliyun.com/zh/live/developer-reference/handling-of-exceptions-and-special-scenarios-for-ios

◆ setCustomVideoResolution:

- (int) setCustomVideoResolution: (CGSize) videoSize

设置视频自定义分辨率(直播连麦场景可用,基础直播不可用)

Parameters
videoSize视频宽高
Returns
  • <0: 表示失败;
  • 0: 表示成功;

◆ setErrorDelegate:

- (void) setErrorDelegate: (id< AlivcLivePusherErrorDelegate >) delegate

设置推流错误监听回调

Parameters
delegateAlivcLivePusherErrorDelegate
Note
错误回调和相关处理可参考:https://help.aliyun.com/zh/live/developer-reference/handling-of-exceptions-and-special-scenarios-for-ios

◆ setExposure:

- (int) setExposure: (float) exposure

设置曝光度

Parameters
exposure曝光度
Returns
0:success 非0:failure

◆ setExternalAudioSource:withSampleRate:channelsPerFrame:

- (int) setExternalAudioSource: (BOOL) enable
withSampleRate: (NSUInteger) sampleRate
channelsPerFrame: (NSUInteger) channelsPerFrame 

设置是否启用外部音频输入源

Parameters
enableYES:开启; NO:关闭
sampleRate采样率 16k, 48k...
channelsPerFrame声道数 1:单声道; 2:双声道
Returns
  • >=0: 成功
  • <0: 失败

◆ setExternalAudioStream:playoutVolume:

- (int) setExternalAudioStream: (int) streamId
playoutVolume: (int) playoutVolume 

设置外部音频流播放音量

Parameters
streamId外部音频流Id
playoutVolume播放音量,取值范围[0, 100]
Returns
  • <0: 表示失败;
  • 0: 表示成功;

◆ setExternalAudioStream:publishVolume:

- (int) setExternalAudioStream: (int) streamId
publishVolume: (int) publishVolume 

设置外部音频流推流音量

Parameters
streamId外部音频流Id
publishVolume推流音量,取值范围[0, 100]
Returns
  • <0: 表示失败;
  • 0: 表示成功;

◆ setExternalVideoSource:sourceType:renderMode:

- (int) setExternalVideoSource: (BOOL) enable
sourceType: (AliLiveVideoSource) type
renderMode: (AliLiveRenderMode) renderMode 

启用外部视频输入源

Parameters
enable
  • YES 开启
  • NO 关闭
type流类型,详见 AliLiveVideoSource
  • AliLiveVideoSourceCameraType 外部输入视频数据走相机流通道,如果当前相机采集打开中,调用该接口设置enable为YES,sdk会替换掉相机采集
  • AliLiveVideoSourceScreenShareType 外部输入视频数据走屏幕流通道,如果当前屏幕共享采集打开中,调用该接口设置enable为YES,sdk会替换掉屏幕共享采集
renderMode处理模式,外部输入视频源宽高比和推流profile不一致时,会按照对应的rendermode做对应处理,详见AliLiveRenderMode
  • AliLiveRenderModeAuto 自动(默认) 如果外部输入的视频宽高比和推流设置的宽高比不一致时,维持外部输入的视频宽高比,等比例缩放宽高到推流设置的宽高范围内,注意此模式下为了保证原始视频的比例和内容完整性,会导致实际推流的分辨率和设置的不一致
  • AliLiveRenderModeStretch 拉伸平铺,如果外部输入的视频宽高比和推流设置的宽高比不一致时,将输入视频拉伸到推流设置的比例,画面会变形
  • AliLiveRenderModeFill 填充黑边,如果外部输入的视频宽高比和推流设置的宽高比不一致时,将输入视频上下或者左右填充黑边
  • AliLiveRenderModeCrop 裁剪,如果外部输入的视频宽高比和推流设置的宽高比不一致时,将输入视频宽或者高进行裁剪,画面内容会丢失
Returns
  • 0: 成功
  • 非0: 失败
Note
通过pushExternalVideoFrame接口向SDK 输入自定义数据

◆ setFlash:

- (int) setFlash: (bool) flash

闪光灯开关

Parameters
flashtrue:打开闪光灯 false:关闭闪光灯
Returns
0:success 非0:failure

◆ setInfoDelegate:

- (void) setInfoDelegate: (id< AlivcLivePusherInfoDelegate >) delegate

设置推流状态监听回调

Parameters
delegateAlivcLivePusherInfoDelegate

◆ setLiveMixTranscodingConfig:

- (int) setLiveMixTranscodingConfig: (AlivcLiveTranscodingConfig *) config

设置云端的混流(转码)参数 一个直播间中可能有不止一位主播,而且每个主播都有自己的画面和声音,但对于 CDN 观众来说,他们只需要一路直播流 所以您需要将多路音视频流混成一路标准的直播流,这就需要混流转码 在连麦场景下,需要将主播和连麦观众音视频流混成一路标准的直播流,供CDN观众观看 在PK场景下,需要将进行PK的多个主播的音视频流混成一路标准的直播流,供CDN观众观看

Parameters
config参考AlivcLiveDef.h中关于AlivcLiveTranscodingConfig的介绍,如果传入nil,则取消云端混流转码
Returns
0:success 非0:failure
Note
若主播还在房间中但不再需要混流,请务必传入 nil 进行取消,因为当发起混流后,云端混流模块就会开始工作, 不及时取消混流可能会引起不必要的计费损失

◆ setLogLevel:

- (int) setLogLevel: ("Use AlivcLiveBase->setLogLevel instead.") __deprecated_msg

设置Log级别

Parameters
levelLog级别 default:AlivcLivePushLogLevelError
Returns
0:success 非0:failure

◆ setLogPath:maxPartFileSizeInKB:

- (int) setLogPath: (NSString *) logPath
maxPartFileSizeInKB: ("Use AlivcLiveBase->setLogPath:maxPartFileSizeInKB instead.") __deprecated_msg 

设置Log路径

Parameters
logPathLog路径
maxPartFileSizeInKB每个分片最大大小。最终日志总体积是 5*最大分片大小
Returns
0:success 非0:failure

◆ setMinVideoBitrate:

- (int) setMinVideoBitrate: (int) minBitrate

设置最小码率

Parameters
minBitrate最小码率 [100 5000](Kbps)
Returns
0:success 非0:failure

◆ setMixedWithMic:

- (int) setMixedWithMic: (BOOL) mixed

设置是否与麦克风采集音频混合

Parameters
mixedYES:混音;NO:完全替换麦克风采集数据
Returns
  • 0: 成功
  • 非0: 失败

◆ setMixVideoMirror:isMirror:

- (void) setMixVideoMirror: (int) handler
isMirror: (BOOL) isMirror 

改变视频混流镜像

Parameters
handler视频混流标识ID,通过addMixVideo接口获得
isMirror是否镜像
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下改变视频混流镜像,AlivcLivePushInteractiveMode模式下暂时不支持改变视频混流镜像

◆ setMute:

- (void) setMute: (bool) mute

静音推流

Parameters
mutetrue:静音推流 false:正常推流
Note
调用此接口,控制音频流是否静音;即使在静音时,仍然占用系统麦克风权限,发送静音音频数据
如果希望不再占用系统麦克风权限,即:关闭音频采集,可调用接口:AlivcLivePusher::stopAudioCapture

◆ setMute:mode:

- (void) setMute: (BOOL) mute
mode: (AliLiveMuteLocalAudioMode) mode 

停止/恢复本地音频数据发送

Parameters
muteYES表示静音本地音频,发送静音帧; NO表示取消静音;
mode静音模式,静音模式分三种,详见 AliLiveMuteLocalAudioMode
Returns
  • 0: 成功
  • 非0: 失败
Note
静音是指音频流发送静音帧,采集和编码模块仍然在工作,仍然占用系统麦克风权限
如果希望不再占用系统麦克风权限,即:关闭音频采集,可调用接口:AlivcLivePusher::stopAudioCapture

◆ setNetworkDelegate:

- (void) setNetworkDelegate: (id< AlivcLivePusherNetworkDelegate >) delegate

设置推流网络监听回调

Parameters
delegateAlivcLivePusherNetworkDelegate
Note
网络监听回调和相关处理可参考: https://help.aliyun.com/zh/live/developer-reference/handling-of-exceptions-and-special-scenarios-for-ios

◆ setParameter:

- (int) setParameter: (NSString *_Nonnull) param

设置自定义参数

Parameters
param自定义参数
Returns
  • 0: 成功
  • 非0: 失败

◆ setpreviewDisplayMode:

- (void) setpreviewDisplayMode: (AlivcPusherPreviewDisplayMode) displayMode

设置预览显示模式

Parameters
displayMode预览显示模式

◆ setPreviewMirror:

- (void) setPreviewMirror: (bool) mirror

预览镜像开关

Parameters
mirrortrue:打开预览镜像 false:关闭预览镜像
Note
SDK默认前置摄像头预览镜像,后置摄像头预览不镜像

◆ setPushMirror:

- (void) setPushMirror: (bool) mirror

推流镜像开关

Parameters
mirrortrue:打开推流镜像 false:关闭推流镜像
Note
SDK默认推流不镜像

◆ setQualityMode:

- (int) setQualityMode: (AlivcLivePushQualityMode) qualityMode

设置推流模式

Parameters
qualityMode推流模式 : 选择 ResolutionFirst 模式时,SDK内部会优先保障推流视频的清晰度; 选择 FluencyFirst 模式时,SDK内部会优先保障推流视频的流畅度,此接口只支持这两种模式。设置后码率设置失效。
Returns
0:success 非0:failure
Note
此接口只在基础模式下生效,互动模式下不生效

◆ setResolution:

- (void) setResolution: (AlivcLivePushResolution) resolution

设置推流分辨率

Parameters
resolution推流分辨率
Note
此接口可以动态调整推流分辨率,例如在多人PK场景,根据PK人数的不同需要动态调整推流分辨率,可以使用该接口

◆ setSnapshotDelegate:

- (void) setSnapshotDelegate: (id< AlivcLivePusherSnapshotDelegate >) delegate

设置截图回调

Parameters
delegateAlivcLivePusherSnapshotDelegate

◆ setTargetVideoBitrate:

- (int) setTargetVideoBitrate: (int) targetBitrate

设置目标码率

Parameters
targetBitrate目标码率 [100 5000](Kbps)
Returns
0:success 非0:failure

◆ setVideoEncoderConfiguration:

- (void) setVideoEncoderConfiguration: (AliLiveVideoEncoderConfiguration *_Nonnull) config

设置相机流视频编码属性

该方法用于设置相机流视频编码属性对应的视频参数,如分辨率、帧率、码率等 所有设置的参数都有相应的范围限制,如果设置的参数不在有效范围内,SDK会自动调节

Parameters
config预定义的编码属性,详见 AliLiveVideoEncoderConfiguration

◆ setVideoMirrorMode:

- (int) setVideoMirrorMode: (AliLiveVideoPipelineMirrorMode) mirrorMode

设置预览和推流镜像能力

Parameters
mirrorMode设置镜像的模式
Returns
  • 0: 设置成功
  • <0: 设置失败
Note
  • 此接口在入会前和入会后均可以动态设置,SDK内部会记录状态,并在可以操作预览及编码的时候对视频进行操作;
  • 此接口与setPreviewMirror & setPushMirror里面的mirror重合,使用时只要使用其中一个即可

◆ setWatermark:rect:

- (void) setWatermark: (nullable UIImage *) image
rect: (CGRect) rect 

添加水印(互动模式下使用该接口添加水印)

Note
水印位置是通过 rect 参数来指定,rect 是一个四元组参数,其格式为 (x,y,width,height),其中x和y是水印的坐标,取值范围为0 1的浮点数。width:水印的宽度,取值范围为0 - 1的浮点数,height:不需要设置的,SDK 内部会根据水印图片的宽高比自动计算高度。 例如:当推流分辨率是 720 × 1280时,rect 参数为(0.1,0.1,0.3,0.0),则水印的左上角坐标点就是(720 × 0.1,1280 × 0.1)即(72,128),水印的宽度是720x0.3=216,水印高度是根据水印图片的宽高比自动算出来。
Parameters
image水印图片, 使用透明底色的 png 格式。
rect水印相对于推流分辨率的相对坐标,x,y,width,height 取值范围0 - 1。

◆ setWatermarkVisible:

- (void) setWatermarkVisible: (bool) visable

设置水印显示和隐藏

Parameters
visabletrue:显示水印,false:隐藏水印

◆ setZoom:

- (int) setZoom: (float) zoom

缩放

Parameters
zoom缩放值[0:MaxZoom]
Returns
0:success 非0:failure

◆ showDebugView

+ (void) showDebugView

显示调试悬浮窗(已废弃)

Note
已废弃使用
Deprecated

◆ snapshot:interval:

- (void) snapshot: (int) count
interval: (int) interval 

截图

Parameters
count截图次数
interval截图间隔
Note
livePushMode = AlivcLivePushBasicMode 基础模式下可以指定count和interval, AlivcLivePushInteractiveMode模式下暂时不支持指定count和interval,传递任何值都不做解析,每次只截图一张画面

◆ startAudioCapture:

- (void) startAudioCapture: (BOOL) keepAlive

开启音频采集

Parameters
keepAliveYES: 停止推流后麦克风采集设备保持开启状态;NO: 停止推流后麦克风采集设备关闭
Note
调用此接口,开始采集音频数据并发送,将会占用系统麦克风权限
关闭音频采集,对应接口:AlivcLivePusher::stopAudioCapture
如果只需要静音,不关闭音频采集,请参考以下接口:AlivcLivePusher::setMute:

◆ startAudioPlayer

- (void) startAudioPlayer

开启音频播放

Note
此接口可以控制提前打开音频播放,如果不设置,则SDK会在订阅到音频流后自动打开音频播放

◆ startBGMWithMusicPathAsync:

- (int) startBGMWithMusicPathAsync: (NSString *) path

播放背景音乐

Parameters
path背景音乐路径
Returns
0:success 非0:failure

◆ startBGMWithMusicPathAsync:config:

- (int) startBGMWithMusicPathAsync: (NSString *) path
config: (AlivcLiveBGMConfig *_Nonnull) config 

播放背景音乐

Parameters
path背景音乐路径
config背景音乐播放配置
Returns
0:success 非0:failure

◆ startIntelligentDenoise

- (int) startIntelligentDenoise

开启智能降噪

Returns
  • 0: 成功
  • 非0: 返回错误码
  • 智能降噪功能以插件形式提供,直播SDK采用插件形式提供音视频增强能力,可通过[官网组件文档] 进行组建下载,参考插件集成文档集成进直播推流引擎 https://help.aliyun.com/document_detail/600551.html
  • 调用该接口前,请确保已集成了直播官网提供的pulginAliDenoise.framework
  • 此接口可以通话过程中控制打开智能降噪功能,通话过程中可以支持开启和关闭智能降噪
  • 默认关闭,开启后可能导致功耗增加,智能降噪适合于会议,教育等语音通讯为主的场景,不适合有背景音乐的场景

◆ startLastmileDetect:

- (int) startLastmileDetect: (AliLiveNetworkQualityProbeConfig *_Nonnull) config

开始网络质量探测

Parameters
config网络探测配置,AliLiveNetworkQualityProbeConfig

网络质量探测需要在未推流 startPush之前调用,探测结果,开始推流后不能调用startLastmileDetect

Note
在3s左右,粗略的结果会在 AlivcLivePusherNetworkDelegate::onLastmileDetectResultWithQuality:networkQuality: 中回调
在30s左右,更多的结果会在 AlivcLivePusherNetworkDelegate::onLastmileDetectResultWithBandWidth:code:result: 中回调
Returns
  • 0: 成功
  • <0: 失败

◆ startLocalDualAudioStream

- (int) startLocalDualAudioStream

开启第二路音频流推送

Note
开启后第二路音频流推送后,可以调用addExternalAudioStream添加音频数据源,使用pushExternalAudioStream向第二路音频通道输入音频数据基础
直播连麦场景使用,基础直播不可用
Returns
  • 0:成功
  • 非0:失败

◆ startPreview:

- (int) startPreview: (UIView *) previewView

开始预览 同步接口

Parameters
previewView预览view
Returns
0:success 非0:failure
Note
该接口对应的回调:AlivcLivePusherInfoDelegate::onPreviewStarted:
预览成功对应的回调:AlivcLivePusherInfoDelegate::onFirstFramePreviewed:
如果需要更新渲染View(例如刚开始在A view上渲染,需要更新到B view上渲染),可以调用接口:AlivcLivePusher::updateLocalView:
如果需要调整预览现实样式(例如裁剪、拉升),可参考接口设置:AlivcLivePushConfig::previewDisplayModeAlivcLivePusher::setpreviewDisplayMode:

◆ startPreviewAsync:

- (int) startPreviewAsync: (UIView *) preview

开始预览 异步接口

Parameters
preview预览view
Returns
0:success 非0:failure
Note
该接口对应的回调:AlivcLivePusherInfoDelegate::onPreviewStarted:
预览成功对应的回调:AlivcLivePusherInfoDelegate::onFirstFramePreviewed:
如果需要更新渲染View(例如刚开始在A view上渲染,需要更新到B view上渲染),可以调用接口:AlivcLivePusher::updateLocalView:
如果需要调整预览现实样式(例如裁剪、拉升),可参考接口设置:AlivcLivePushConfig::previewDisplayModeAlivcLivePusher::setpreviewDisplayMode:

◆ startPushWithURL:

- (int) startPushWithURL: (NSString *) pushURL

开始推流 同步接口

Parameters
pushURL推流URL
Returns
0:success 非0:failure
Note
该接口调用后可收到的回调:
  1. 推流链接建立成功:AlivcLivePusherInfoDelegate::onPushStarted: 2.发送第一帧音视频流成功回调,可作为推流成功回调: AlivcLivePusherInfoDelegate::onFirstFramePushed:

◆ startPushWithURLAsync:

- (int) startPushWithURLAsync: (NSString *) pushURL

开始推流 异步接口

Parameters
pushURL推流URL
Returns
0:success 非0:failure
Note
该接口调用后可收到的回调:
  1. 推流链接建立成功:AlivcLivePusherInfoDelegate::onPushStarted: 2.发送第一帧音视频流成功回调,可作为推流成功回调: AlivcLivePusherInfoDelegate::onFirstFramePushed:

◆ startRecording:

- (BOOL) startRecording: (AlivcLiveLocalRecoderConfig *_Nullable) config

开启本地音视频流录制

Note
开启后把直播中的音视频内容录制到本地的一个文件。调用接口后,通过onMediaRecordEvent回调通知录制状态
Parameters
config本地录制参数,参见AlivcLiveLocalRecoderConfig

◆ startScreenCapture:

- (int) startScreenCapture: (NSString *) appGroup

开始屏幕分享(该接口支持 iOS 11.0 及以上的 iPhone 和 iPad)。

该接口开始 iOS 系统的屏幕分享,可以实现录屏推流功能 该接口配合AlivcLibReplayKitExt.framework使用,在Extension进程中添加AlivcLibReplayKitExt.framework库完成屏幕采集和发送 在Host APP中接收音视频数据,完成推流。

Parameters
appGroupApp group ID 主 App 与 Extension 共享的 Application Group Identifier,当前接口仅支持主 App 与 Extension 属于同一个App * Group的情况,如果不存在App Group, 不可调用该接口。
Note
注:当前SDK暂时只支持在livePushMode = AlivcLivePushBasicMode 模式下开始屏幕分享(录屏推流),AlivcLivePushInteractiveMode模式下暂时不支持开始屏幕分享(录屏推流)

◆ startScreenShare

- (int) startScreenShare

启动屏幕分享

Note
直播连麦场景开启第二路视频推送,可以通过setExternalVideoSource设置外部视频源,通过pushExternalVideoFrame向第二路视频通道输入视频数据
Returns
  • 0:成功
  • 非0:失败

◆ stopAllAudioEffects

- (int) stopAllAudioEffects

停止播放所有音效

Returns
  • 0:成功
  • 非0:失败

◆ stopAudioCapture

- (void) stopAudioCapture

关闭音频采集

Note
调用此接口后,采集设备关闭
调用此接口,关闭音频采集,不再占用系统麦克风权限,且不再发送音频数据
如果调用此接口后系统仍显示有麦克风权限的占用,请检查是否由其它功能引起
开启音频采集,对应接口:AlivcLivePusher::startAudioCapture:
如果只需要静音,不关闭音频采集,请参考以下接口:AlivcLivePusher::setMute:

◆ stopAudioEffectWithSoundId:

- (int) stopAudioEffectWithSoundId: (NSInteger) soundId

停止播放音效

Parameters
soundId用户给该音效文件分配的ID,每个音效均有唯一的ID,如果你已通过 preloadAudioEffectWithSoundId:filePath: 将音效加载至内存,确保这里的soundId与 preloadAudioEffectWithSoundId:filePath: 设置的soundId相同
Returns
  • 0:成功
  • 非0:失败

◆ stopAudioPlayer

- (void) stopAudioPlayer

关闭音频播放

Note
此接口可以控制关闭音频播放,与 startAudioPlayer 对应

◆ stopBGMAsync

- (int) stopBGMAsync

停止播放背景音乐

Returns
0:success 非0:failure

◆ stopIntelligentDenoise

- (int) stopIntelligentDenoise

关闭智能降噪

Note
此接口可以通话过程中控制关闭智能降噪功能

◆ stopLastmileDetect

- (int) stopLastmileDetect

停止网络质量探测

Returns
  • 0: 成功
  • <0: 失败

◆ stopLocalDualAudioStream

- (int) stopLocalDualAudioStream

停止第二路音频流推送

Note
直播连麦场景使用,基础直播不可用
Returns
  • 0:成功
  • 非0:失败

◆ stopPreview

- (int) stopPreview

停止预览

Returns
0:success 非0:failure
Note
该接口对应的回调:AlivcLivePusherInfoDelegate::onPreviewStoped:

◆ stopPush

- (int) stopPush

停止推流

Returns
0:success 非0:failure
Note
该接口调用后可收到的回调: AlivcLivePusherInfoDelegate::onPushStoped:

◆ stopRecording

- (void) stopRecording

停止本地音视频流录制

Note
如果录制任务在结束推流前尚未通过本接口停止,则结束推流后录制任务会自动被停止。

◆ stopScreenShare

- (int) stopScreenShare

停止屏幕分享

Note
停止第二路视频推送
Returns
  • 0:成功
  • 非0:失败

◆ switchCamera

- (int) switchCamera

切换摄像头

Returns
0:success 非0:failure

◆ unloadAudioEffectWithSoundId:

- (int) unloadAudioEffectWithSoundId: (NSInteger) soundId

删除预加载的音效文件

Parameters
soundId用户给该音效文件分配的ID
Returns
  • 0:成功
  • !=0:失败
Note
音效soundId应与预加载 preloadAudioEffectWithSoundId:filePath: 时传入的ID相同

◆ unregisterVideoSampleObserver

- (void) unregisterVideoSampleObserver

取消订阅视频数据,调用后onProcessVideoSampleBuffer不回回调

◆ updateLocalView:

- (void) updateLocalView: (UIView *) view

更新本地摄像头的预览画面

Parameters
view预览view
Note
如果需要更新渲染View(例如刚开始在A view上渲染,需要更新到B view上渲染),可以调用此接口
注:该API暂时只支持在livePushMode = AlivcLivePushInteractiveMode 模式下生效,AlivcLivePushBasicMode模式下暂时不支持该API,调用无任何效果

The documentation for this class was generated from the following file: