public class AlivcLivePusher extends java.lang.Object implements ILivePusher
关于AlivcLivePusher的主题有:
音视频推流的控制按照状态机进行管理。下面的状态图展示了一个AlivcLivePusher对象在使用过程中的完整的生命周期和状态变化。


| 方法名 | 有效状态 | 无效状态 | 备注 |
| init | {Idle, Initialized} | {Previewed, Pushed, Paused, Error} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Initialized |
| destroy | any | {} | 调用此方法之后,状态变为{Idle} |
| startPreview | {Initialized, Previewed} | {Idle, Pushed, Paused, Error} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Previewed |
| startPreviewAysnc | {Initialized, Previewed} | {Idle, Pushed, Paused, Error,} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Previewed |
| stopPreview | {Initialized, Previewed} | {Idle, Pushed, Paused, Error} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Initialized |
| startPush | {Initialized, Previewed, Pushed} | {Idle,Paused, Error} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Pushed |
| startPushAysnc | {Initialized, Previewed, Pushed} | {Idle, Paused, Error} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Pushed |
| restartPush | {Pushed, Error} | {Idle, Initialized, Previewed, Paused} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Pushed |
| restartPushAync | {Pushed, Error} | {Idle, Initialized, Previewed, Paused,} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Pushed |
| reconnectPushAsync | {Pushed, Paused} | {Idle, Initialized, Previewed, Error} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Initialized |
| stopPush | {Previewed, Pushed,Error} | {Idle, Initialized, Previewed, Pushed, Paused} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Initialized |
| pause | {Pushed,Paused,Previewed} | {Idle, Initialized, Error} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Initialized |
| resume | {Paused,Pushed,Previewed,Initialized} | {Idle, Error} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Initialized |
| resumeAsync | {Paused,Pushed,Previewed,Initialized} | {Idle, Error} | 无效的状态调用此方法,状态不变。在有效的状态下调用此方法,状态变为Initialized |
这个类需要 {android.permission.CAMERA} {android.permission.RECORD_AUDIO} 权限
在Activity的onPause和onResume的时候,需要调用pause和resume函数来应对处理处理前后台切换、锁屏、界面跳转及电话等场景。
在使用推流SDK的过程中,有以下几个接口由于涉及到硬解和网络,导致接口调用时间消耗可能会较长,因此我们同时也提供了异步接口。此外,我们还提供了一个异步的重连接口方便来处理网络错误。
在调用接口的时候,有的接口会抛出 IllegalArgumentException 和 IllegalStateException
| Constructor and Description |
|---|
AlivcLivePusher() |
| Modifier and Type | Method and Description |
|---|---|
int |
addDynamicsAddons(java.lang.String path,
float x,
float y,
float w,
float h)
添加动态贴纸
|
void |
addWaterMark(java.lang.String path,
float x,
float y,
float width)
添加水印,起点位置坐标x[0,width) y[0,height),宽度(0,width],最多添加3个
需在startPreview之后调用
|
void |
changeResolution(AlivcResolutionEnum resolutionEnum)
change resolution dynamically
|
void |
destroy()
释放推流
|
void |
focusCameraAtAdjustedPoint(float x,
float y,
boolean autoFocus)
对焦,对焦点的坐标x[0,屏幕宽度],y[0,屏幕宽度]
|
int |
getCurrentExposure()
获取采集曝光
|
AlivcLivePushStats |
getCurrentStatus()
获取当前状态
|
int |
getCurrentZoom()
获取当前缩放值
|
AlivcLivePushError |
getLastError()
获取最近的错误值
|
AlivcLivePushStatsInfo |
getLivePushStatsInfo()
获取推流统计数据
|
java.lang.String |
getLiveTraceId()
获取直播trace id
|
int |
getMaxZoom()
获取摄像头支持的最大缩放值, 0 : 不支持缩放 大于0 : 最大缩放值
|
java.lang.String |
getPushUrl()
获取推流URL
|
int |
getSupportedMaxExposure()
获取采集支持最大曝光
|
int |
getSupportedMinExposure()
获取采集支持最小曝光
|
void |
init(android.content.Context context,
AlivcLivePushConfig config)
初始化推流参数
|
void |
inputStreamAudioData(byte[] data,
int size,
int sampleRate,
int channels,
long pts)
输入自定义音频数据
|
void |
inputStreamAudioPtr(long dataPtr,
int size,
int sampleRate,
int channels,
long pts)
输入自定义音频数据
|
void |
inputStreamVideoData(byte[] data,
int width,
int height,
int stride,
int size,
long pts,
int rotation)
输入自定义视频流
|
void |
inputStreamVideoPtr(long dataptr,
int width,
int height,
int stride,
int size,
long pts,
int rotation)
输入自定义视频流
|
boolean |
isCameraSupportAutoFocus()
获取是否支持自动对焦
|
boolean |
isCameraSupportFlash()
获取是否支持闪光灯
|
boolean |
isNetworkPushing()
获取当前网络推流状态
|
boolean |
isPushing()
是否正在推流
|
void |
pause()
暂停推流
|
void |
pauseBGM()
暂停播放背景音乐
|
void |
pauseScreenCapture()
暂停录屏推流(隐私开)
|
void |
reconnectPushAsync(java.lang.String url)
重新连接进行推流
|
void |
removeDynamicsAddons(int id)
删除动态贴纸
|
void |
restartPush()
重新开始推流
|
void |
restartPushAync()
重新开始推流
|
void |
resume()
恢复推流
|
void |
resumeAsync()
异步恢复推流
|
void |
resumeBGM()
恢复播放背景音乐
|
void |
resumeScreenCapture()
恢复录屏推流(隐私关)
|
void |
sendMessage(java.lang.String info,
int repeat,
int delay,
boolean isKeyFrame)
推流端发送自定义消息
|
void |
setAudioDenoise(boolean on)
设置音频降噪
|
int |
setAudioEffectReverbMode(AlivcLivePushAudioEffectReverbMode mode)
设置混响音效模式
推流前和推流过程中调用都生效
|
int |
setAudioEffectVoiceChangeMode(AlivcLivePushAudioEffectVoiceChangeMode mode)
设置变声音效模式
推流前和推流过程中调用都生效
|
void |
setAutoFocus(boolean autoFocus)
设置自动对焦
|
void |
setBGMEarsBack(boolean isOpen)
设置耳返开关
|
void |
setBGMLoop(boolean isLoop)
设置背景音乐是否循环播放
|
void |
setBGMVolume(int volume)
设置背景音乐混音 人声音量
|
void |
setCaptureVolume(int volume)
设置背景音乐混音 音乐音量
|
void |
setCustomAudioFilter(AlivcLivePushCustomAudioFilter customAudioFilter)
设置用户自定义音频处理回调
|
void |
setCustomDetect(AlivcLivePushCustomDetect customVideoDetect)
设置用户自定义视频人脸识别回调
|
void |
setCustomFilter(AlivcLivePushCustomFilter customVideoFilter)
设置用户自定义视频美颜回调
|
void |
setExposure(int exposure)
设置采集曝光
|
void |
setFlash(boolean flash)
是否打开闪光灯
|
int |
setLiveMixTranscodingConfig(AlivcLiveTranscodingConfig config)
设置云端的混流(转码)参数
一个直播间中可能有不止一位主播,而且每个主播都有自己的画面和声音,但对于 CDN 观众来说,他们只需要一路直播流
所以您需要将多路音视频流混成一路标准的直播流,这就需要混流转码
在连麦场景下,需要将主播和连麦观众音视频流混成一路标准的直播流,供CDN观众观看
在PK场景下,需要将进行PK的多个主播的音视频流混成一路标准的直播流,供CDN观众观看
|
void |
setLivePushBGMListener(AlivcLivePushBGMListener pushBGMListener)
设置背景播放通知事件
|
void |
setLivePusherReference(AlivcLivePusher livePusher)
设置直播推流实例
|
void |
setLivePushErrorListener(AlivcLivePushErrorListener errorListener)
设置推流错误事件
|
void |
setLivePushInfoListener(AlivcLivePushInfoListener infoListener)
设置推流通知事件
|
void |
setLivePushNetworkListener(AlivcLivePushNetworkListener networkListner)
设置网络通知事件
|
void |
setLivePushRenderContextListener(AlivcLivePusherRenderContextListener renderCtxListener)
设置render的context监听
|
void |
setMinVideoBitrate(int minVideoBitrate)
设置最小视频码率[100,5000] (Kbps)
|
void |
setMute(boolean mute)
是否静音
|
void |
setPreviewMirror(boolean mirror)
预览镜像开关
|
void |
setPreviewMode(AlivcPreviewDisplayMode mode)
设置预览显示模式
|
void |
setPreviewOrientation(AlivcPreviewOrientationEnum orientation)
设置推流方向,默认竖屏
|
void |
setPushMirror(boolean mirror)
推流端是否水平镜像
|
void |
setQualityMode(AlivcQualityModeEnum mode)
设置视频质量模式
|
void |
setScreenOrientation(int orientation)
录屏模式下,设置感应的屏幕旋转角度
|
void |
setTargetVideoBitrate(int targetVideoBitrate)
设置目标视频码率[100,5000](Kbps)
|
void |
setWatermarkVisible(boolean visible)
设置水印可见
|
void |
setZoom(int zoom)
设置缩放[0,getMaxZoom()]
|
void |
snapshot(int count,
int interval,
AlivcSnapshotListener listener)
视频流截图
|
void |
startBGMAsync(java.lang.String path)
播放背景音
|
int |
startCamera(android.view.SurfaceView surfaceView)
录屏模式下,开启摄像头预览
如果不需要预览,则surfaceview填为null
|
int |
startCameraMix(float x,
float y,
float w,
float h)
录屏模式下,开启摄像头混流
|
int |
startIntelligentDenoise()
开启音频智能降噪
1、使用智能降噪,请关闭普通降噪;两者功能互斥使用
2、智能降噪功能以插件形式提供,调用该接口前,请确保已集成了libpluginAliDenoise.so;插件获取方式请参考官网文档;
3、此接口可以通话过程中控制打开智能降噪功能,通话过程中可以支持开启和关闭智能降噪
4、默认关闭,开启后可能导致功耗增加,智能降噪适合于会议,教育等语音通讯为主的场景,不适合有背景音乐的场景
注意事项!!!
|
void |
startPreview(android.content.Context context,
android.widget.FrameLayout frameLayout,
boolean isAnchor)
开始预览
|
void |
startPreview(android.view.SurfaceView surfaceView)
开始预览
|
void |
startPreviewAysnc(android.view.SurfaceView surfaceView)
异步开始预览
|
void |
startPush(java.lang.String url)
开始推流
|
void |
startPushAysnc(java.lang.String url)
开始推流
|
void |
stopBGMAsync()
停止播放背景音乐
|
void |
stopCamera()
录屏模式下,关闭摄像头预览
|
void |
stopCameraMix()
录屏模式下,停止摄像头混流
|
int |
stopIntelligentDenoise()
关闭音频智能降噪
此接口可以通话过程中控制关闭智能降噪功能
|
void |
stopPreview()
结束预览
|
void |
stopPush()
结束推流
|
void |
switchCamera()
切换摄像头
|
public void init(android.content.Context context,
AlivcLivePushConfig config)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePusherinit in interface ILivePushercontext - 上下文config - 配置java.lang.IllegalArgumentException - 如果 config为空,或者config的值为无效(例如码率的值超过范围)java.lang.IllegalStateException - 如果状态不对,例如已经初始化,但是还没有销毁public void destroy()
throws java.lang.IllegalStateException
ILivePusherdestroy in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化public void setLivePusherReference(AlivcLivePusher livePusher)
ILivePushersetLivePusherReference in interface ILivePusherlivePusher - 推流实例public void startPreview(android.view.SurfaceView surfaceView)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePusherstartPreview in interface ILivePushersurfaceView - surfaceviewjava.lang.IllegalArgumentException - 如果surfaceView为空,或者surfaceView的surface未创建/已销毁java.lang.IllegalStateException - 如果状态不对,例如还未初始化public void startPreviewAysnc(android.view.SurfaceView surfaceView)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePusherstartPreviewAysnc in interface ILivePushersurfaceView - surfaceviewjava.lang.IllegalArgumentException - 如果surfaceView为空,或者surfaceView的surface未创建/已销毁java.lang.IllegalStateException - 如果状态不对,例如还未初始化public void startPreview(android.content.Context context,
android.widget.FrameLayout frameLayout,
boolean isAnchor)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePusherstartPreview in interface ILivePusherjava.lang.IllegalArgumentExceptionjava.lang.IllegalStateExceptionpublic void stopPreview()
throws java.lang.IllegalStateException
ILivePusherstopPreview in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewpublic void startPush(java.lang.String url)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePusherstartPush in interface ILivePusherurl - 推流Urljava.lang.IllegalArgumentException - 如果url为空,或者不是有效的url格式java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewpublic void startPushAysnc(java.lang.String url)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePusherstartPushAysnc in interface ILivePusherurl - 推流Urljava.lang.IllegalArgumentException - 如果url为空,或者不是有效的url格式java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewpublic void restartPush()
throws java.lang.IllegalStateException
ILivePusherrestartPush in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPushpublic void restartPushAync()
throws java.lang.IllegalStateException
ILivePusherrestartPushAync in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPushpublic void reconnectPushAsync(java.lang.String url)
throws java.lang.IllegalStateException
ILivePusherreconnectPushAsync in interface ILivePusherjava.lang.IllegalStateExceptionpublic void stopPush()
throws java.lang.IllegalStateException
ILivePusherstopPush in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPushpublic void pause()
throws java.lang.IllegalStateException
ILivePusherpause in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPush/已经pausepublic void resume()
throws java.lang.IllegalStateException
ILivePusherresume in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resumepublic void resumeAsync()
throws java.lang.IllegalStateException
ILivePusherresumeAsync in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resumepublic void switchCamera()
throws java.lang.IllegalStateException
ILivePusherswitchCamera in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewpublic void setAutoFocus(boolean autoFocus)
throws java.lang.IllegalStateException
ILivePushersetAutoFocus in interface ILivePusherautoFocus - 自动聚焦java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewpublic void focusCameraAtAdjustedPoint(float x,
float y,
boolean autoFocus)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePusherfocusCameraAtAdjustedPoint in interface ILivePusherx - 对焦的点x坐标y - 对焦的点y坐标yautoFocus - 是否自动聚焦java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewjava.lang.IllegalArgumentExceptionpublic void setZoom(int zoom)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePushersetZoom in interface ILivePusherzoom - 0~getMaxZoom()java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewjava.lang.IllegalArgumentExceptionpublic int getMaxZoom()
throws java.lang.IllegalStateException
ILivePushergetMaxZoom in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewpublic int getCurrentZoom()
throws java.lang.IllegalStateException
ILivePushergetCurrentZoom in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewpublic void setMute(boolean mute)
throws java.lang.IllegalStateException
ILivePushersetMute in interface ILivePushermute - true:静音推流 false:正常推流java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPushpublic void setFlash(boolean flash)
throws java.lang.IllegalStateException
ILivePushersetFlash in interface ILivePusherflash - true:打开闪光灯 false:关闭闪光灯java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewpublic void setPushMirror(boolean mirror)
throws java.lang.IllegalStateException
ILivePushersetPushMirror in interface ILivePushermirror - true:打开推流镜像 false:关闭推流镜像java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPushpublic void setPreviewMirror(boolean mirror)
throws java.lang.IllegalStateException
ILivePushersetPreviewMirror in interface ILivePushermirror - true:打开预览镜像 false:关闭预览镜像java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreviewpublic void setTargetVideoBitrate(int targetVideoBitrate)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePushersetTargetVideoBitrate in interface ILivePushertargetVideoBitrate - 目标视频编码码率java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPushjava.lang.IllegalArgumentExceptionpublic void setMinVideoBitrate(int minVideoBitrate)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
ILivePushersetMinVideoBitrate in interface ILivePusherminVideoBitrate - 最小视频编码码率java.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPushjava.lang.IllegalArgumentExceptionpublic boolean isCameraSupportAutoFocus()
ILivePusherisCameraSupportAutoFocus in interface ILivePusherpublic boolean isCameraSupportFlash()
ILivePusherisCameraSupportFlash in interface ILivePusherpublic boolean isPushing()
throws java.lang.IllegalStateException
ILivePusherisPushing in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPushpublic boolean isNetworkPushing()
throws java.lang.IllegalStateException
ILivePusherisNetworkPushing in interface ILivePusherjava.lang.IllegalStateExceptionpublic void setCustomDetect(AlivcLivePushCustomDetect customVideoDetect)
ILivePushersetCustomDetect in interface ILivePushercustomVideoDetect - 回调接口public void setCustomFilter(AlivcLivePushCustomFilter customVideoFilter)
ILivePushersetCustomFilter in interface ILivePushercustomVideoFilter - 回调接口public void setCustomAudioFilter(AlivcLivePushCustomAudioFilter customAudioFilter)
ILivePushersetCustomAudioFilter in interface ILivePushercustomAudioFilter - 回调接口public AlivcLivePushStats getCurrentStatus()
ILivePushergetCurrentStatus in interface ILivePusherpublic void setLivePushErrorListener(AlivcLivePushErrorListener errorListener)
ILivePushersetLivePushErrorListener in interface ILivePushererrorListener - 错误监听器public void setLivePushInfoListener(AlivcLivePushInfoListener infoListener)
ILivePushersetLivePushInfoListener in interface ILivePusherinfoListener - 通知监听器public void setLivePushNetworkListener(AlivcLivePushNetworkListener networkListner)
ILivePushersetLivePushNetworkListener in interface ILivePushernetworkListner - 通知监听器public void setLivePushBGMListener(AlivcLivePushBGMListener pushBGMListener)
ILivePushersetLivePushBGMListener in interface ILivePusherpushBGMListener - 通知监听器public void setLivePushRenderContextListener(AlivcLivePusherRenderContextListener renderCtxListener)
ILivePushersetLivePushRenderContextListener in interface ILivePusherrenderCtxListener - render的context监听public AlivcLivePushStatsInfo getLivePushStatsInfo() throws java.lang.IllegalStateException
ILivePushergetLivePushStatsInfo in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化public java.lang.String getPushUrl()
ILivePushergetPushUrl in interface ILivePusherpublic void setPreviewOrientation(AlivcPreviewOrientationEnum orientation)
ILivePushersetPreviewOrientation in interface ILivePusherorientation - 推流方向public int setAudioEffectVoiceChangeMode(AlivcLivePushAudioEffectVoiceChangeMode mode)
ILivePusher推流前和推流过程中调用都生效
setAudioEffectVoiceChangeMode in interface ILivePushermode - 变声音效模式变声音效模式枚举public int setAudioEffectReverbMode(AlivcLivePushAudioEffectReverbMode mode)
ILivePusher推流前和推流过程中调用都生效
setAudioEffectReverbMode in interface ILivePushermode - 混响音效模式混响音效模式枚举public void startBGMAsync(java.lang.String path)
throws java.lang.IllegalStateException
ILivePusherstartBGMAsync in interface ILivePusherpath - 背景音乐路径java.lang.IllegalStateExceptionpublic void stopBGMAsync()
throws java.lang.IllegalStateException
ILivePusherstopBGMAsync in interface ILivePusherjava.lang.IllegalStateExceptionpublic void pauseBGM()
throws java.lang.IllegalStateException
ILivePusherpauseBGM in interface ILivePusherjava.lang.IllegalStateExceptionpublic void resumeBGM()
throws java.lang.IllegalStateException
ILivePusherresumeBGM in interface ILivePusherjava.lang.IllegalStateExceptionpublic void setBGMLoop(boolean isLoop)
throws java.lang.IllegalStateException
ILivePushersetBGMLoop in interface ILivePusherisLoop - 是否循环 true:循环 false:不循环java.lang.IllegalStateExceptionpublic void setBGMEarsBack(boolean isOpen)
throws java.lang.IllegalStateException
ILivePushersetBGMEarsBack in interface ILivePusherisOpen - 是否循环 true:开启耳返 false:关闭耳返java.lang.IllegalStateExceptionpublic void setBGMVolume(int volume)
throws java.lang.IllegalStateException,
java.lang.IllegalArgumentException
ILivePushersetBGMVolume in interface ILivePushervolume - 人声音量大小 范围:[0 ~ 100] 默认:50java.lang.IllegalStateExceptionjava.lang.IllegalArgumentExceptionpublic void setCaptureVolume(int volume)
throws java.lang.IllegalStateException,
java.lang.IllegalArgumentException
ILivePushersetCaptureVolume in interface ILivePushervolume - 音乐音量大小 范围:[0 ~ 100] 默认:50java.lang.IllegalStateExceptionjava.lang.IllegalArgumentExceptionpublic void setAudioDenoise(boolean on)
ILivePushersetAudioDenoise in interface ILivePusheron - true:开启 false:关闭public int startIntelligentDenoise()
ILivePusher1、使用智能降噪,请关闭普通降噪;两者功能互斥使用 2、智能降噪功能以插件形式提供,调用该接口前,请确保已集成了libpluginAliDenoise.so;插件获取方式请参考官网文档; 3、此接口可以通话过程中控制打开智能降噪功能,通话过程中可以支持开启和关闭智能降噪 4、默认关闭,开启后可能导致功耗增加,智能降噪适合于会议,教育等语音通讯为主的场景,不适合有背景音乐的场景
注意事项!!! 如遇libMNN相关的so冲突,请检查当前工程中是否使用到了视频云的其它产品,如美颜SDK/Animoji SDK 美颜SDK/Animoji SDK中,包含libMNN相关的so,因此外部无需再导入一份,只保留libpluginAliDenoise.so, 全局MNN相关的库,统一留一份即可; 具体请查看官网文档或API文档,或者您可以咨询技术同学协助解决问题;
startIntelligentDenoise in interface ILivePusherpublic int stopIntelligentDenoise()
ILivePusher此接口可以通话过程中控制关闭智能降噪功能
stopIntelligentDenoise in interface ILivePusherpublic void setQualityMode(AlivcQualityModeEnum mode) throws java.lang.IllegalStateException
ILivePushersetQualityMode in interface ILivePusherjava.lang.IllegalStateExceptionpublic void setPreviewMode(AlivcPreviewDisplayMode mode) throws java.lang.IllegalStateException
ILivePushersetPreviewMode in interface ILivePusherjava.lang.IllegalStateExceptionpublic void pauseScreenCapture()
throws java.lang.IllegalStateException
ILivePusherpauseScreenCapture in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPush/已经pausepublic void resumeScreenCapture()
throws java.lang.IllegalStateException
ILivePusherresumeScreenCapture in interface ILivePusherjava.lang.IllegalStateException - 如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resumepublic AlivcLivePushError getLastError()
ILivePushergetLastError in interface ILivePusherpublic void changeResolution(AlivcResolutionEnum resolutionEnum)
ILivePusherchangeResolution in interface ILivePusherpublic void addWaterMark(java.lang.String path,
float x,
float y,
float width)
ILivePusheraddWaterMark in interface ILivePusherpath - 水印图片x - 水印左上角x轴位置 相对位置 0~1y - 水印右上角y轴位置 相对位置 0~1width - 水印显示宽度 相对位置 0~1public void setWatermarkVisible(boolean visible)
ILivePushersetWatermarkVisible in interface ILivePushervisible - 是否可见public int startCamera(android.view.SurfaceView surfaceView)
throws java.lang.IllegalStateException
ILivePusherstartCamera in interface ILivePusherjava.lang.IllegalStateExceptionpublic void stopCamera()
ILivePusherstopCamera in interface ILivePusherpublic void setScreenOrientation(int orientation)
ILivePushersetScreenOrientation in interface ILivePusherpublic int startCameraMix(float x,
float y,
float w,
float h)
ILivePusherstartCameraMix in interface ILivePusherx - 混流显示x初始位置(0~1.0f)y - 混流显示y初始位置(0~1.0f)w - 混流显示宽度(0~1.0f)h - 混流显示高度(0~1.0f)public void stopCameraMix()
ILivePusherstopCameraMix in interface ILivePusherpublic void snapshot(int count,
int interval,
AlivcSnapshotListener listener)
ILivePushersnapshot in interface ILivePushercount - 截取图片的个数,该参数仅在普通模式下生效!!!interval - 每张图片的间隔,该参数仅在普通模式下生效!!!listener - 截图回调public void inputStreamVideoPtr(long dataptr,
int width,
int height,
int stride,
int size,
long pts,
int rotation)
ILivePusherinputStreamVideoPtr in interface ILivePusherdataptr - native内存指针width - 视频图像宽度height - 视频图像高度size - 视频图像sizepts - 视频图像pts(us)rotation - 视频图像旋转角度public void inputStreamVideoData(byte[] data,
int width,
int height,
int stride,
int size,
long pts,
int rotation)
ILivePusherinputStreamVideoData in interface ILivePusherdata - 视频图像byte arraywidth - 视频图像宽度height - 视频图像高度size - 视频图像sizepts - 视频图像pts(us)rotation - 视频图像旋转角度public void inputStreamAudioPtr(long dataPtr,
int size,
int sampleRate,
int channels,
long pts)
ILivePusherinputStreamAudioPtr in interface ILivePusherdataPtr - 音频数据native内存指针pts - 音频数据pts(US)public void inputStreamAudioData(byte[] data,
int size,
int sampleRate,
int channels,
long pts)
ILivePusherinputStreamAudioData in interface ILivePusherdata - 音频数据 byte arraypts - 音频数据pts(US)public int addDynamicsAddons(java.lang.String path,
float x,
float y,
float w,
float h)
ILivePusheraddDynamicsAddons in interface ILivePusherpath - 贴纸路径,带config.jsonx - 显示起始x位置(0~1.0f)y - 显示起始y位置(0~1.0f)w - 显示宽度(0~1.0f)h - 显示高度(0~1.0f)public void removeDynamicsAddons(int id)
ILivePusherremoveDynamicsAddons in interface ILivePusherid - 贴纸idpublic void setExposure(int exposure)
ILivePushersetExposure in interface ILivePusherpublic int getCurrentExposure()
ILivePushergetCurrentExposure in interface ILivePusherpublic int getSupportedMinExposure()
ILivePushergetSupportedMinExposure in interface ILivePusherpublic int getSupportedMaxExposure()
ILivePushergetSupportedMaxExposure in interface ILivePusherpublic void sendMessage(java.lang.String info,
int repeat,
int delay,
boolean isKeyFrame)
ILivePushersendMessage in interface ILivePusherinfo - 需要插入流的SEI消息体,建议是json格式repeat - 发送的帧数delay - 延时多少毫秒发送isKeyFrame - 是否只发送关键帧public int setLiveMixTranscodingConfig(AlivcLiveTranscodingConfig config)
ILivePushersetLiveMixTranscodingConfig in interface ILivePusherconfig - 参考AlivcLiveDef.h中关于AlivcLiveTranscodingConfig的介绍,如果传入nil,则取消云端混流转码public java.lang.String getLiveTraceId()
ILivePushergetLiveTraceId in interface ILivePusher