![]() |
AlivcLivePusher v7.8.0
Aliyun Live Pusher API Reference Manual for iOS Platforms
|
#include "AlivcLivePusher.h"
Class Methods | |
| ("Use AlivcLiveBase->getSDKVersion instead.") | + __deprecated_msg |
| 获取SDK版本号 | |
| (void) | + hideDebugView |
| 隐藏调试悬浮窗(已废弃) | |
| (void) | + showDebugView |
| 显示调试悬浮窗(已废弃) | |
| + ("Use AlivcLiveBase->getSDKVersion instead.") __deprecated_msg |
获取SDK版本号
| - (int) addDynamicWaterMarkImageDataWithPath: | (NSString *) | waterMarkDirPath | |
| x: | (float) | x | |
| y: | (float) | y | |
| w: | (float) | w | |
| h: | (float) | h |
添加动态贴纸,最多支持添加5个贴纸
| waterMarkDirPath:贴纸图片sequence目录 | |
| 显示屏幕x位置(0~1.0f) | |
| 显示屏幕y位置(0~1.0f) | |
| 显示屏幕宽 | |
| 显示屏幕高 |
| - (int) addExternalAudioStream: | (AliLiveExternalAudioStreamConfig *_Nonnull) | config |
新增外部音频流
| config | 外部音频流配置 |
| - (int) addMixAudio: | (int) | channels | |
| format: | (int) | format | |
| audioSample: | (int) | audioSample |
添加音频混流设置
| channels | 声道数 |
| format | 音频格式 AlivcLivePushAudioFormat |
| audioSample | 音频采样率 |
| - (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 |
添加视频混流设置
| format | 原始视频数据格式 |
| width | 图像宽 |
| height | 图像高 |
| rotation | 图像角度 |
| displayX | 图像要放置到屏幕的左上角坐标x |
| displayY | 图像要放置到屏幕的左上角坐标y |
| displayW | 图像显示的宽度 |
| displayH | 图像显示的高度 |
| adjustHeight | 图像自适应的高度 |
| - (int) addWatermarkWithPath: | (NSString *) | path | |
| watermarkCoordX: | (CGFloat) | coordX | |
| watermarkCoordY: | (CGFloat) | coordY | |
| watermarkWidth: | (CGFloat) | width |
添加水印 最多支持3个水印
| path | 水印路径 |
| coordX | 水印左上顶点x的相对坐标 [0,1] |
| coordY | 水印左上顶点y的相对坐标 [0,1] |
| width | 水印的相对宽度 (水印会根据水印图片实际大小和水印宽度等比缩放) (0,1] |
| - (void) changeMixVideoPosition: | (int) | handler | |
| displayX: | (float) | displayX | |
| displayY: | (float) | displayY | |
| displayW: | (float) | displayW | |
| displayH: | (float) | displayH |
改变视频混流位置
| handler | 视频混流标识ID,通过addMixVideo接口获得 |
| displayX | 图像要放置到屏幕的左上角坐标x |
| displayY | 图像要放置到屏幕的左上角坐标y |
| displayW | 图像显示的宽度 |
| displayH | 图像显示的高度 |
| - (void) destory |
销毁推流引擎
| - (int) enableAudioFrameObserver: | (bool) | enable | |
| audioSource: | (AliLiveAudioSource) | audioSource | |
| config: | (AliLiveAudioFrameObserverConfig *_Nullable) | config |
设置音频回调参数
| enable | 是否允许数据回调 |
| audioSource | 回调数据源类型,详见 AliLiveAudioSource |
| config | 回调参数设置,详见AliLiveAudioFrameObserverConfig, null时默认参数为48000,1,ReadOnly |
| - (int) enableAudioVolumeIndication: | (int) | interval | |
| smooth: | (int) | smooth | |
| reportVad: | (int) | reportVad |
设置音量回调频率和平滑系数
| interval | 时间间隔,单位毫秒,最小值不得小于10ms, 建议设置300-500ms, <= 0表示不启用音量提示和说话人提示功能 |
| smooth | 平滑系数,数值越大平滑程度越高,反之越低,实时性越好,建议设置3,范围[0, 9]; |
| reportVad | 说话人检测开关
|
AlivcLivePusherInfoDelegate::onMicrophoneVolumeUpdate:volume:回调 | - (int) enableLocalCamera: | (BOOL) | enabled |
禁用或启用本地视频采集(非互动模式暂不支持该API,调用无任何效果)
| enabled |
|
| - (int) enableSEIVideoStream: | (bool) | enable |
开启SEI视频流,内部将使用16x16全黑图片流/20fps
| enable | true=开启 false=关闭 |
| - (int) enableSpeakerphone: | (BOOL) | enable |
设置音频输出为听筒还是扬声器
| enable |
|
| - (int) focusCameraAtAdjustedPoint: | (CGPoint) | point | |
| autoFocus: | (bool) | autoFocus |
对焦
| point | 对焦的点,point.x和point.y的取值是(0,1),表示当前点相对于渲染view的相对位置 |
| autoFocus | 是否自动对焦 |
| - (int) getAudioEffectPlayoutVolumeWithSoundId: | (NSInteger) | soundId |
获取音效本地播放音量
| soundId | 用户给该音效文件分配的ID |
playAudioEffectWithSoundId:filePath:cycles:publish: 后调用 | - (int) getAudioEffectPublishVolumeWithSoundId: | (NSInteger) | soundId |
获取音效推流混音音量
| soundId | 用户给该音效文件分配的ID |
playAudioEffectWithSoundId:filePath:config: 后调用 | - (int) getBGMCurrentPosition |
获取伴奏文件播放进度,单位为毫秒
| - (int) getBGMDuration |
获取伴奏文件时长, 单位为毫秒
| - (AlivcLiveVideoCodecManufacturer) getCurrentEncoderManufacturer: | (BOOL) | isCameraStreem |
获取当前使用的编码器类型,如未开始推流,返回无效类型
| isCameraStreem | YES: 获取摄像头流的编码器类型; NO: 获取共享流的编码器类型 |
| - (float) getCurrentExposure |
获取当前曝光度
| - (float) getCurrentZoom |
获取当前变焦值
| - (AlivcLivePushStatsInfo *) getLivePushStatusInfo |
获取推流数据统计
AlivcLivePushStatsInfo | - (AlivcLivePushStatus) getLiveStatus |
获取当前推流状态
| - (float) getMaxZoom |
获取支持的最大变焦值
| - (NSString *) getParameter: | (NSString *) | param |
获取自定义参数
| param | 自定义参数 |
| - (NSString *) getPushURL |
获取当前推流URL
| - (float) getSupportedMaxExposure |
获取支持最大曝光度
| - (float) getSupportedMinExposure |
获取支持最小曝光度
| - (AlivcLivePushVideoEncoderModeHardCodec) getVideoCodecType |
获取当前视频编码格式
| + (void) hideDebugView |
| - (instancetype) initWithConfig: | (AlivcLivePushConfig *) | config |
创建一个推流引擎实例
| config | 推流配置信息 AlivcLivePushConfig |
AlivcLivePusher::destory | - (bool) inputMixAudioData: | (int) | handler | |
| data: | (long) | dataptr | |
| size: | (int) | size | |
| pts: | (long) | pts |
输入音频混流数据
| handler | 音频混流标识ID,通过addMixAudio接口获得 |
| dataptr | 数据buffer的地址 |
| size | 音频数据的大小 |
| pts | 时间戳(单位微秒) |
| - (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 |
输入视频混流数据
| handler | 视频混流标识ID,通过addMixVideo接口获得 |
| dataptr | 数据buffer的地址 |
| width | 图像宽 |
| height | 图像高 |
| stride | 图像存储时内存中每行像素所占用的空间 |
| size | 此帧图像的大小 |
| pts | 时间戳(单位微秒) |
| rotation | 图像角度 |
| - (BOOL) isCameraAutoFocusFaceModeSupported |
摄像头是否支持人脸聚焦
| - (BOOL) isEnableSpeakerphone |
获取当前音频输出为听筒还是扬声器
| - (BOOL) isPushing |
获取是否正在推流
| - (int) muteLocalCamera: | (BOOL) | mute |
关闭/打开视频(非互动模式暂不支持该API,调用无任何效果)
| mute | YES表示不发送视频数据;NO表示恢复正常 |
| - (int) pause |
暂停摄像头推流,如果pushCongfig 中设置了pauseImg图片,将推设置的静态图片
| - (int) pauseAllAudioEffects |
暂停所有音效
| - (int) pauseAudioEffectWithSoundId: | (NSInteger) | soundId |
暂停音效
| soundId | 用户给该音效文件分配的ID |
| - (int) pauseBGM |
暂停播放背景音乐
| - (int) playAudioEffectWithSoundId: | (NSInteger) | soundId | |
| filePath: | (NSString *_Nonnull) | filePath | |
| config: | (AliLiveAudioEffectConfig *_Nonnull) | config |
开始播放音效
开始播放音效接口,可以多次调用该方法传入不同的soundId和filePath,同时播放多个音效文件,音效文件播放结束后,SDK 会触发 onAudioEffectFinished: 回调
| soundId | 用户给该音效文件分配的ID,每个音效均有唯一的ID,如果你已通过 preloadAudioEffectWithSoundId:filePath: 将音效加载至内存,确保这里的soundId与 preloadAudioEffectWithSoundId:filePath: 设置的soundId相同 |
| filePath | 文件路径,支持本地文件和网络url |
| config | 音效播放配置,详见AliLiveAudioEffectConfig |
| - (int) preloadAudioEffectWithSoundId: | (NSInteger) | soundId | |
| filePath: | (NSString *_Nonnull) | filePath |
预加载音效文件
| soundId | 用户给该音效文件分配的ID |
| filePath | 音效文件路径,支持本地文件和网络url |
| - (int) pushExternalAudioStream: | (int) | streamId | |
| rawData: | (AlivcLivePusherAudioDataSample *_Nonnull) | audioFrame |
输入外部音频流数据
| streamId | 外部音频流Id(addExternalAudioStream的返回值) |
| audioFrame | 音频数据 |
| - (int) pushExternalVideoFrame: | (AlivcLiveVideoDataSample *_Nonnull) | frame | |
| sourceType: | (AliLiveVideoSource) | type |
输入视频数据
| frame | 帧数据,详见 AlivcLiveVideoDataSample |
| type | 流类型,详见 AliLiveVideoSource
|
| - (int) reconnectPushAsync |
重连 异步接口
| - (int) reconnectPushAsync: | (NSString *) | pushURL |
推流URL的重连 异步接口
| - (int) refreshPushURLToken: | (NSString *_Nonnull) | pushUrl |
刷新Token鉴权信息,传入一个新的推流URL,包含未过期的新token信息,房间ID/用户ID/sdkAppId需要和之前保持一样
该方法用于更新鉴权信息推流URL中的token信息,主要为了防止鉴权过期,导致推流失败,当我们收到 onPushURLTokenWillExpire 回调时,应用应当更新鉴权信息
| pushURL | 推流URL |
| - (void) registerVideoSampleObserver |
订阅视频数据
| - (void) removeDynamicWaterMark: | (int) | vid |
删除动态贴纸
| vid:贴纸id,addDynamicWaterMarkImageDataWithPath时返回 |
| - (int) removeExternalAudioStream: | (int) | streamId |
删除外部音频流
| streamId | 外部音频流Id |
| - (void) removeMixAudio: | (int) | handler |
移除音频混流
| handler | 音频混流标识ID,通过addMixAudio接口获得 |
| - (void) removeMixVideo: | (int) | handler |
移除视频混流设置
| handler | 视频混流标识ID,通过addMixVideo接口获得 |
| - (int) restartPush |
重新推流 同步接口
| - (int) restartPushAsync |
重新推流 异步接口
| - (int) resume |
恢复摄像头推流 同步接口
| - (int) resumeAllAudioEffects |
恢复所有音效文件
| - (int) resumeAsync |
恢复推流 异步接口
| - (int) resumeAudioEffectWithSoundId: | (NSInteger) | soundId |
恢复指定音效文件
| soundId | 用户给该音效文件分配的ID |
| - (int) resumeBGM |
恢复播放背景音乐
| - (void) sendAudioSampleBuffer: | (CMSampleBufferRef) | sampleBuffer | |
| withType: | (RPSampleBufferType) | sampleBufferType |
发送自定义的audio SampleBuffer
只限于replaykit录屏直播使用
| sampleBuffer | audio sample buffer |
| sampleBufferType | audio sample buffer type |
| - (int) sendDataChannelMessage: | (NSString *) | message |
通过数据通道发送自定义消息
| message | 自定义消息 |
| - (int) sendMessage: | (NSString *) | msg | |
| repeatCount: | (int) | count | |
| delayTime: | (int) | time | |
| KeyFrameOnly: | (bool) | isKeyFrame |
设置自定义Message (SEI)
| msg | 用户推流消息 |
| count | 重复次数 |
| time | 延时时间,单位毫秒 |
| isKeyFrame | 是否只发关键帧,该参数只支持在livePushMode = AlivcLivePushBasicMode 模式下设置,AlivcLivePushInteractiveMode模式下暂时不支持设置,互动模式下传入false |
| - (int) sendMessage: | (NSString *) | msg | |
| repeatCount: | (int) | count | |
| delayTime: | (int) | time | |
| KeyFrameOnly: | (bool) | isKeyFrame | |
| payloadType: | (int) | payloadType |
设置自定义Message (SEI)
| msg | 用户推流消息 |
| count | 重复次数 |
| time | 延时时间,单位毫秒 |
| isKeyFrame | 是否只发关键帧,该参数只支持在livePushMode = AlivcLivePushBasicMode 模式下设置,AlivcLivePushInteractiveMode模式下暂时不支持设置, ,互动模式下传入false |
| payloadType | 类型,可设置的值为5或者[100..254]范围区间,如果设置5,则在内容前面会有一个16字节的UUID |
| - (void) sendPCMData: | (char *) | data | |
| size: | (int) | size | |
| sampleRate: | (int) | sampleRate | |
| channel: | (int) | channel | |
| pts: | (uint64_t) | pts |
发送自定义音频数据
| data | 音频数据 |
| size | 数据大小 |
| sampleRate | 采样率 |
| channel | 声道数 |
| pts | 时间戳(单位微秒) |
| - (void) sendVideoData: | (char *) | data | |
| width: | (int) | width | |
| height: | (int) | height | |
| size: | (int) | size | |
| pts: | (uint64_t) | pts | |
| rotation: | (int) | rotation |
发送自定义视频数据
| data | 视频数据 |
| width | 视频宽度 |
| height | 视频高度 |
| size | 数据大小 |
| pts | 时间戳(单位微秒) |
| rotation | 旋转 |
| - (void) sendVideoSampleBuffer: | (CMSampleBufferRef) | sampleBuffer |
发送自定义video SampleBuffer
| sampleBuffer | video sample buffer |
| - (int) setAllAudioEffectsPlayoutVolume: | (NSInteger) | volume |
设置所有音效本地播音量
| volume | 音效本地播放音量,范围:[0, 100],默认值:50 |
| - (int) setAllAudioEffectsPublishVolume: | (NSInteger) | volume |
设置所有音效推流混音音量
| volume | 推流混音音量,范围是:[0, 100],默认值:50 |
| - (int) setAudioDenoise: | (bool) | isOpen |
设置降噪开关
| isOpen | 是否打开降噪 true:开启 false:关闭 默认:true |
| - (int) setAudioEffectBeautifyMode: | (AliLiveAudioEffectBeautifyMode) | mode |
设置美声音效模式
| mode | 参考 AliLiveAudioEffectBeautifyMode 对应的美声模式 |
| - (int) setAudioEffectEqualizationParam: | (AliLiveAudioEffectEqualizationBandFrequency) | bandIndex | |
| gain: | (float) | gain |
设置均衡器参数
| bandIndex | 均衡器段数[0,9] center frequency [31,62,125,250,500,1000,2000,4000,8000,16000] Hz AliLiveAudioEffectEqualizationBandFrequency |
| gain | 均衡器增益db [-15,15] default 0 |
| - (int) setAudioEffectPitchValue: | (double) | value |
设置变调参数
| value | 变调参数,范围:[0.5, 2.0],1.0表示音调不变,小于1.0表示音调降低,大于1.0表示音调升高,默认1.0 |
| - (int) setAudioEffectPlayoutVolumeWithSoundId: | (NSInteger) | soundId | |
| volume: | (NSInteger) | volume |
设置音效本地播放音量
| soundId | 用户给该音效文件分配的ID |
| volume | 音效本地播放音量,范围:[0, 100],默认值:50 |
playAudioEffectWithSoundId:filePath:cycles:publish: 后调用 | - (int) setAudioEffectPublishVolumeWithSoundId: | (NSInteger) | soundId | |
| volume: | (NSInteger) | volume |
设置音效推流混音音量
| soundId | 用户给该音效文件分配的ID |
| volume | 推流混音音量,范围是:[0, 100],默认值:50 |
playAudioEffectWithSoundId:filePath:config: 后调用 | - (int) setAudioEffectReverbMode: | (AlivcLivePushAudioEffectReverbMode) | mode |
设置混响音效模式
| mode | 参考AlivcLivePushAudioEffectReverbMode 对应的混响模式 |
| - (int) setAudioEffectReverbParamType: | (AliLiveAudioEffectReverbParamType) | type | |
| value: | (float) | value |
设置混响音效类型
| type | 参考AliLiveAudioEffectReverbParamType 对应的混响类型 |
| value | 混响参数值,不同混响类型的取值范围参考 AliLiveAudioEffectReverbParamType中取值说明 |
| - (int) setAudioEffectVoiceChangeMode: | (AlivcLivePushAudioEffectVoiceChangeMode) | mode |
设置变声音效模式
| mode | 参考AlivcLivePushAudioEffectVoiceChangerMode对应的变声音效模式值 |
| - (int) setAudioProfile: | (AlivcLiveAudioProfile) | audio_profile |
设置音频profile
| audio_profile | 音频采集/编码模式参数, 详见AlivcLiveAudioProfile |
| - (void) setAudioSampleDelegate: | (id< AlivcLivePusherAudioSampleDelegate >) | delegate |
设置音频裸数据回调
| delegate | AlivcLivePusherAudioSampleDelegate |
| - (int) setAutoFocus: | (bool) | autoFocus |
设置自动对焦
| autoFocus | true:自动对焦 false:手动对焦 |
| - (void) setBGMDelegate: | (id< AlivcLivePusherBGMDelegate >) | delegate |
设置背景音乐监听回调
| delegate | AlivcLivePusherBGMDelegate |
| - (int) setBGMEarsBack: | (bool) | isOpen |
设置背景音乐耳返开关
| isOpen | 是否打开耳返 true:开启耳返 false:关闭耳返 |
| - (int) setBGMLoop: | (bool) | isLoop |
设置背景音乐是否循环播放
| isLoop | 是否循环 true:循环 false:不循环 |
| - (int) setBGMVolume: | (int) | volume |
设置背景音乐混音 音乐音量
| volume | 音乐音量大小 范围:[0 ~ 100] 默认:50 |
| - (BOOL) setCameraAutoFocusFaceModeEnabled: | (BOOL) | enable |
设置摄像头人脸对焦
| enable | YES: 开启; NO:关闭 |
| - (int) setCaptureVolume: | (int) | volume |
设置背景音乐混音 人声音量
| volume | 人声音量大小 范围:[0 ~ 100] 默认:50 |
| - (int) setChannelProfile: | (AlivcLiveChannelProfile) | profile |
设置频道模式
根据业务需求可以配置不同的频道模式,AliRTC会根据不用的频道模式模式采用不用的策略,目前主要提供通信模式(默认)、互动模式、低延迟互动直播模式
| profile | 频道模式类型, 详细请参考 AlivcLiveChannelProfile |
| - (void) setCustomDetectorDelegate: | (id< AlivcLivePusherCustomDetectorDelegate >) | delegate |
设置用户自定义人脸识别回调
| delegate | AlivcLivePusherCustomDetectorDelegate |
| - (void) setCustomFilterDelegate: | (id< AlivcLivePusherCustomFilterDelegate >) | delegate |
设置用户自定义滤镜回调
| delegate | AlivcLivePusherCustomFilterDelegate |
| - (int) setCustomVideoResolution: | (CGSize) | videoSize |
设置视频自定义分辨率(直播连麦场景可用,基础直播不可用)
| videoSize | 视频宽高 |
| - (void) setErrorDelegate: | (id< AlivcLivePusherErrorDelegate >) | delegate |
设置推流错误监听回调
| delegate | AlivcLivePusherErrorDelegate |
| - (int) setExposure: | (float) | exposure |
设置曝光度
| exposure | 曝光度 |
| - (int) setExternalAudioSource: | (BOOL) | enable | |
| withSampleRate: | (NSUInteger) | sampleRate | |
| channelsPerFrame: | (NSUInteger) | channelsPerFrame |
设置是否启用外部音频输入源
| enable | YES:开启; NO:关闭 |
| sampleRate | 采样率 16k, 48k... |
| channelsPerFrame | 声道数 1:单声道; 2:双声道 |
| - (int) setExternalAudioStream: | (int) | streamId | |
| playoutVolume: | (int) | playoutVolume |
设置外部音频流播放音量
| streamId | 外部音频流Id |
| playoutVolume | 播放音量,取值范围[0, 100] |
| - (int) setExternalAudioStream: | (int) | streamId | |
| publishVolume: | (int) | publishVolume |
设置外部音频流推流音量
| streamId | 外部音频流Id |
| publishVolume | 推流音量,取值范围[0, 100] |
| - (int) setExternalVideoSource: | (BOOL) | enable | |
| sourceType: | (AliLiveVideoSource) | type | |
| renderMode: | (AliLiveRenderMode) | renderMode |
启用外部视频输入源
| enable |
|
| type | 流类型,详见 AliLiveVideoSource
|
| renderMode | 处理模式,外部输入视频源宽高比和推流profile不一致时,会按照对应的rendermode做对应处理,详见AliLiveRenderMode
|
| - (int) setFlash: | (bool) | flash |
闪光灯开关
| flash | true:打开闪光灯 false:关闭闪光灯 |
| - (void) setInfoDelegate: | (id< AlivcLivePusherInfoDelegate >) | delegate |
设置推流状态监听回调
| delegate | AlivcLivePusherInfoDelegate |
| - (int) setLiveMixTranscodingConfig: | (AlivcLiveTranscodingConfig *) | config |
设置云端的混流(转码)参数 一个直播间中可能有不止一位主播,而且每个主播都有自己的画面和声音,但对于 CDN 观众来说,他们只需要一路直播流 所以您需要将多路音视频流混成一路标准的直播流,这就需要混流转码 在连麦场景下,需要将主播和连麦观众音视频流混成一路标准的直播流,供CDN观众观看 在PK场景下,需要将进行PK的多个主播的音视频流混成一路标准的直播流,供CDN观众观看
| config | 参考AlivcLiveDef.h中关于AlivcLiveTranscodingConfig的介绍,如果传入nil,则取消云端混流转码 |
| - (int) setLogLevel: | ("Use AlivcLiveBase->setLogLevel instead.") | __deprecated_msg |
设置Log级别
| level | Log级别 default:AlivcLivePushLogLevelError |
| - (int) setLogPath: | (NSString *) | logPath | |
| maxPartFileSizeInKB: | ("Use AlivcLiveBase->setLogPath:maxPartFileSizeInKB instead.") | __deprecated_msg |
设置Log路径
| logPath | Log路径 |
| maxPartFileSizeInKB | 每个分片最大大小。最终日志总体积是 5*最大分片大小 |
| - (int) setMinVideoBitrate: | (int) | minBitrate |
设置最小码率
| minBitrate | 最小码率 [100 5000](Kbps) |
| - (int) setMixedWithMic: | (BOOL) | mixed |
设置是否与麦克风采集音频混合
| mixed | YES:混音;NO:完全替换麦克风采集数据 |
| - (void) setMixVideoMirror: | (int) | handler | |
| isMirror: | (BOOL) | isMirror |
改变视频混流镜像
| handler | 视频混流标识ID,通过addMixVideo接口获得 |
| isMirror | 是否镜像 |
| - (void) setMute: | (bool) | mute |
静音推流
| mute | true:静音推流 false:正常推流 |
AlivcLivePusher::stopAudioCapture | - (void) setMute: | (BOOL) | mute | |
| mode: | (AliLiveMuteLocalAudioMode) | mode |
停止/恢复本地音频数据发送
| mute | YES表示静音本地音频,发送静音帧; NO表示取消静音; |
| mode | 静音模式,静音模式分三种,详见 AliLiveMuteLocalAudioMode |
AlivcLivePusher::stopAudioCapture | - (void) setNetworkDelegate: | (id< AlivcLivePusherNetworkDelegate >) | delegate |
设置推流网络监听回调
| delegate | AlivcLivePusherNetworkDelegate |
| - (int) setParameter: | (NSString *_Nonnull) | param |
设置自定义参数
| param | 自定义参数 |
| - (void) setpreviewDisplayMode: | (AlivcPusherPreviewDisplayMode) | displayMode |
设置预览显示模式
| displayMode | 预览显示模式 |
| - (void) setPreviewMirror: | (bool) | mirror |
预览镜像开关
| mirror | true:打开预览镜像 false:关闭预览镜像 |
| - (void) setPushMirror: | (bool) | mirror |
推流镜像开关
| mirror | true:打开推流镜像 false:关闭推流镜像 |
| - (int) setQualityMode: | (AlivcLivePushQualityMode) | qualityMode |
设置推流模式
| qualityMode | 推流模式 : 选择 ResolutionFirst 模式时,SDK内部会优先保障推流视频的清晰度; 选择 FluencyFirst 模式时,SDK内部会优先保障推流视频的流畅度,此接口只支持这两种模式。设置后码率设置失效。 |
| - (void) setResolution: | (AlivcLivePushResolution) | resolution |
设置推流分辨率
| resolution | 推流分辨率 |
| - (void) setSnapshotDelegate: | (id< AlivcLivePusherSnapshotDelegate >) | delegate |
设置截图回调
| delegate | AlivcLivePusherSnapshotDelegate |
| - (int) setTargetVideoBitrate: | (int) | targetBitrate |
设置目标码率
| targetBitrate | 目标码率 [100 5000](Kbps) |
| - (void) setVideoEncoderConfiguration: | (AliLiveVideoEncoderConfiguration *_Nonnull) | config |
设置相机流视频编码属性
该方法用于设置相机流视频编码属性对应的视频参数,如分辨率、帧率、码率等 所有设置的参数都有相应的范围限制,如果设置的参数不在有效范围内,SDK会自动调节
| config | 预定义的编码属性,详见 AliLiveVideoEncoderConfiguration |
| - (int) setVideoMirrorMode: | (AliLiveVideoPipelineMirrorMode) | mirrorMode |
设置预览和推流镜像能力
| mirrorMode | 设置镜像的模式 |
| - (void) setWatermark: | (nullable UIImage *) | image | |
| rect: | (CGRect) | rect |
添加水印(互动模式下使用该接口添加水印)
| image | 水印图片, 使用透明底色的 png 格式。 |
| rect | 水印相对于推流分辨率的相对坐标,x,y,width,height 取值范围0 - 1。 |
| - (void) setWatermarkVisible: | (bool) | visable |
设置水印显示和隐藏
| visable | true:显示水印,false:隐藏水印 |
| - (int) setZoom: | (float) | zoom |
缩放
| zoom | 缩放值[0:MaxZoom] |
| + (void) showDebugView |
| - (void) snapshot: | (int) | count | |
| interval: | (int) | interval |
截图
| count截图次数 | |
| interval | 截图间隔 |
| - (void) startAudioCapture: | (BOOL) | keepAlive |
开启音频采集
| keepAlive | YES: 停止推流后麦克风采集设备保持开启状态;NO: 停止推流后麦克风采集设备关闭 |
AlivcLivePusher::stopAudioCapture AlivcLivePusher::setMute: | - (void) startAudioPlayer |
开启音频播放
| - (int) startBGMWithMusicPathAsync: | (NSString *) | path |
播放背景音乐
| path | 背景音乐路径 |
| - (int) startBGMWithMusicPathAsync: | (NSString *) | path | |
| config: | (AlivcLiveBGMConfig *_Nonnull) | config |
播放背景音乐
| path | 背景音乐路径 |
| config | 背景音乐播放配置 |
| - (int) startIntelligentDenoise |
开启智能降噪
| - (int) startLastmileDetect: | (AliLiveNetworkQualityProbeConfig *_Nonnull) | config |
开始网络质量探测
| config | 网络探测配置,AliLiveNetworkQualityProbeConfig |
网络质量探测需要在未推流 startPush之前调用,探测结果,开始推流后不能调用startLastmileDetect
AlivcLivePusherNetworkDelegate::onLastmileDetectResultWithQuality:networkQuality: 中回调 AlivcLivePusherNetworkDelegate::onLastmileDetectResultWithBandWidth:code:result: 中回调 | - (int) startLocalDualAudioStream |
开启第二路音频流推送
| - (int) startPreview: | (UIView *) | previewView |
开始预览 同步接口
| previewView | 预览view |
AlivcLivePusherInfoDelegate::onPreviewStarted: AlivcLivePusherInfoDelegate::onFirstFramePreviewed: AlivcLivePusher::updateLocalView: AlivcLivePushConfig::previewDisplayMode 或 AlivcLivePusher::setpreviewDisplayMode: | - (int) startPreviewAsync: | (UIView *) | preview |
开始预览 异步接口
| preview | 预览view |
AlivcLivePusherInfoDelegate::onPreviewStarted: AlivcLivePusherInfoDelegate::onFirstFramePreviewed: AlivcLivePusher::updateLocalView: AlivcLivePushConfig::previewDisplayMode 或 AlivcLivePusher::setpreviewDisplayMode: | - (int) startPushWithURL: | (NSString *) | pushURL |
开始推流 同步接口
| pushURL | 推流URL |
AlivcLivePusherInfoDelegate::onPushStarted: 2.发送第一帧音视频流成功回调,可作为推流成功回调: AlivcLivePusherInfoDelegate::onFirstFramePushed: | - (int) startPushWithURLAsync: | (NSString *) | pushURL |
开始推流 异步接口
| pushURL | 推流URL |
AlivcLivePusherInfoDelegate::onPushStarted: 2.发送第一帧音视频流成功回调,可作为推流成功回调: AlivcLivePusherInfoDelegate::onFirstFramePushed: | - (BOOL) startRecording: | (AlivcLiveLocalRecoderConfig *_Nullable) | config |
开启本地音视频流录制
| config | 本地录制参数,参见AlivcLiveLocalRecoderConfig |
| - (int) startScreenCapture: | (NSString *) | appGroup |
开始屏幕分享(该接口支持 iOS 11.0 及以上的 iPhone 和 iPad)。
该接口开始 iOS 系统的屏幕分享,可以实现录屏推流功能 该接口配合AlivcLibReplayKitExt.framework使用,在Extension进程中添加AlivcLibReplayKitExt.framework库完成屏幕采集和发送 在Host APP中接收音视频数据,完成推流。
| appGroup | App group ID 主 App 与 Extension 共享的 Application Group Identifier,当前接口仅支持主 App 与 Extension 属于同一个App * Group的情况,如果不存在App Group, 不可调用该接口。 |
| - (int) startScreenShare |
启动屏幕分享
| - (int) stopAllAudioEffects |
停止播放所有音效
| - (void) stopAudioCapture |
关闭音频采集
AlivcLivePusher::startAudioCapture: AlivcLivePusher::setMute: | - (int) stopAudioEffectWithSoundId: | (NSInteger) | soundId |
停止播放音效
| soundId | 用户给该音效文件分配的ID,每个音效均有唯一的ID,如果你已通过 preloadAudioEffectWithSoundId:filePath: 将音效加载至内存,确保这里的soundId与 preloadAudioEffectWithSoundId:filePath: 设置的soundId相同 |
| - (void) stopAudioPlayer |
关闭音频播放
startAudioPlayer 对应 | - (int) stopBGMAsync |
停止播放背景音乐
| - (int) stopIntelligentDenoise |
关闭智能降噪
| - (int) stopLastmileDetect |
停止网络质量探测
| - (int) stopLocalDualAudioStream |
停止第二路音频流推送
| - (int) stopPreview |
| - (int) stopPush |
| - (void) stopRecording |
停止本地音视频流录制
| - (int) stopScreenShare |
停止屏幕分享
| - (int) switchCamera |
切换摄像头
| - (int) unloadAudioEffectWithSoundId: | (NSInteger) | soundId |
删除预加载的音效文件
| soundId | 用户给该音效文件分配的ID |
preloadAudioEffectWithSoundId:filePath: 时传入的ID相同 | - (void) unregisterVideoSampleObserver |
取消订阅视频数据,调用后onProcessVideoSampleBuffer不回回调
| - (void) updateLocalView: | (UIView *) | view |
更新本地摄像头的预览画面
| view | 预览view |