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
ILivePusher
init
in interface ILivePusher
context
- 上下文config
- 配置java.lang.IllegalArgumentException
- 如果 config为空,或者config的值为无效(例如码率的值超过范围)java.lang.IllegalStateException
- 如果状态不对,例如已经初始化,但是还没有销毁public void destroy() throws java.lang.IllegalStateException
ILivePusher
destroy
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化public void setLivePusherReference(AlivcLivePusher livePusher)
ILivePusher
setLivePusherReference
in interface ILivePusher
livePusher
- 推流实例public void startPreview(android.view.SurfaceView surfaceView) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
ILivePusher
startPreview
in interface ILivePusher
surfaceView
- surfaceviewjava.lang.IllegalArgumentException
- 如果surfaceView为空,或者surfaceView的surface未创建/已销毁java.lang.IllegalStateException
- 如果状态不对,例如还未初始化public void startPreviewAysnc(android.view.SurfaceView surfaceView) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
ILivePusher
startPreviewAysnc
in interface ILivePusher
surfaceView
- 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
ILivePusher
startPreview
in interface ILivePusher
java.lang.IllegalArgumentException
java.lang.IllegalStateException
public void stopPreview() throws java.lang.IllegalStateException
ILivePusher
stopPreview
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewpublic void startPush(java.lang.String url) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
ILivePusher
startPush
in interface ILivePusher
url
- 推流Urljava.lang.IllegalArgumentException
- 如果url为空,或者不是有效的url格式java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewpublic void startPushAysnc(java.lang.String url) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
ILivePusher
startPushAysnc
in interface ILivePusher
url
- 推流Urljava.lang.IllegalArgumentException
- 如果url为空,或者不是有效的url格式java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewpublic void restartPush() throws java.lang.IllegalStateException
ILivePusher
restartPush
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPushpublic void restartPushAync() throws java.lang.IllegalStateException
ILivePusher
restartPushAync
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPushpublic void reconnectPushAsync(java.lang.String url) throws java.lang.IllegalStateException
ILivePusher
reconnectPushAsync
in interface ILivePusher
java.lang.IllegalStateException
public void stopPush() throws java.lang.IllegalStateException
ILivePusher
stopPush
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPushpublic void pause() throws java.lang.IllegalStateException
ILivePusher
pause
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPush/已经pausepublic void resume() throws java.lang.IllegalStateException
ILivePusher
resume
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resumepublic void resumeAsync() throws java.lang.IllegalStateException
ILivePusher
resumeAsync
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resumepublic void switchCamera() throws java.lang.IllegalStateException
ILivePusher
switchCamera
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewpublic void setAutoFocus(boolean autoFocus) throws java.lang.IllegalStateException
ILivePusher
setAutoFocus
in interface ILivePusher
autoFocus
- 自动聚焦java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewpublic void focusCameraAtAdjustedPoint(float x, float y, boolean autoFocus) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
ILivePusher
focusCameraAtAdjustedPoint
in interface ILivePusher
x
- 对焦的点x坐标y
- 对焦的点y坐标yautoFocus
- 是否自动聚焦java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewjava.lang.IllegalArgumentException
public void setZoom(int zoom) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
ILivePusher
setZoom
in interface ILivePusher
zoom
- 0~getMaxZoom()java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewjava.lang.IllegalArgumentException
public int getMaxZoom() throws java.lang.IllegalStateException
ILivePusher
getMaxZoom
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewpublic int getCurrentZoom() throws java.lang.IllegalStateException
ILivePusher
getCurrentZoom
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewpublic void setMute(boolean mute) throws java.lang.IllegalStateException
ILivePusher
setMute
in interface ILivePusher
mute
- true:静音推流 false:正常推流java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPushpublic void setFlash(boolean flash) throws java.lang.IllegalStateException
ILivePusher
setFlash
in interface ILivePusher
flash
- true:打开闪光灯 false:关闭闪光灯java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewpublic void setPushMirror(boolean mirror) throws java.lang.IllegalStateException
ILivePusher
setPushMirror
in interface ILivePusher
mirror
- true:打开推流镜像 false:关闭推流镜像java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPushpublic void setPreviewMirror(boolean mirror) throws java.lang.IllegalStateException
ILivePusher
setPreviewMirror
in interface ILivePusher
mirror
- true:打开预览镜像 false:关闭预览镜像java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreviewpublic void setTargetVideoBitrate(int targetVideoBitrate) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
ILivePusher
setTargetVideoBitrate
in interface ILivePusher
targetVideoBitrate
- 目标视频编码码率java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPushjava.lang.IllegalArgumentException
public void setMinVideoBitrate(int minVideoBitrate) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
ILivePusher
setMinVideoBitrate
in interface ILivePusher
minVideoBitrate
- 最小视频编码码率java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPushjava.lang.IllegalArgumentException
public boolean isCameraSupportAutoFocus()
ILivePusher
isCameraSupportAutoFocus
in interface ILivePusher
public boolean isCameraSupportFlash()
ILivePusher
isCameraSupportFlash
in interface ILivePusher
public boolean isPushing() throws java.lang.IllegalStateException
ILivePusher
isPushing
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPushpublic boolean isNetworkPushing() throws java.lang.IllegalStateException
ILivePusher
isNetworkPushing
in interface ILivePusher
java.lang.IllegalStateException
public void setCustomDetect(AlivcLivePushCustomDetect customVideoDetect)
ILivePusher
setCustomDetect
in interface ILivePusher
customVideoDetect
- 回调接口public void setCustomFilter(AlivcLivePushCustomFilter customVideoFilter)
ILivePusher
setCustomFilter
in interface ILivePusher
customVideoFilter
- 回调接口public void setCustomAudioFilter(AlivcLivePushCustomAudioFilter customAudioFilter)
ILivePusher
setCustomAudioFilter
in interface ILivePusher
customAudioFilter
- 回调接口public AlivcLivePushStats getCurrentStatus()
ILivePusher
getCurrentStatus
in interface ILivePusher
public void setLivePushErrorListener(AlivcLivePushErrorListener errorListener)
ILivePusher
setLivePushErrorListener
in interface ILivePusher
errorListener
- 错误监听器public void setLivePushInfoListener(AlivcLivePushInfoListener infoListener)
ILivePusher
setLivePushInfoListener
in interface ILivePusher
infoListener
- 通知监听器public void setLivePushNetworkListener(AlivcLivePushNetworkListener networkListner)
ILivePusher
setLivePushNetworkListener
in interface ILivePusher
networkListner
- 通知监听器public void setLivePushBGMListener(AlivcLivePushBGMListener pushBGMListener)
ILivePusher
setLivePushBGMListener
in interface ILivePusher
pushBGMListener
- 通知监听器public void setLivePushRenderContextListener(AlivcLivePusherRenderContextListener renderCtxListener)
ILivePusher
setLivePushRenderContextListener
in interface ILivePusher
renderCtxListener
- render的context监听public AlivcLivePushStatsInfo getLivePushStatsInfo() throws java.lang.IllegalStateException
ILivePusher
getLivePushStatsInfo
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化public java.lang.String getPushUrl()
ILivePusher
getPushUrl
in interface ILivePusher
public void setPreviewOrientation(AlivcPreviewOrientationEnum orientation)
ILivePusher
setPreviewOrientation
in interface ILivePusher
orientation
- 推流方向public int setAudioEffectVoiceChangeMode(AlivcLivePushAudioEffectVoiceChangeMode mode)
ILivePusher
推流前和推流过程中调用都生效
setAudioEffectVoiceChangeMode
in interface ILivePusher
mode
- 变声音效模式变声音效模式枚举
public int setAudioEffectReverbMode(AlivcLivePushAudioEffectReverbMode mode)
ILivePusher
推流前和推流过程中调用都生效
setAudioEffectReverbMode
in interface ILivePusher
mode
- 混响音效模式混响音效模式枚举
public void startBGMAsync(java.lang.String path) throws java.lang.IllegalStateException
ILivePusher
startBGMAsync
in interface ILivePusher
path
- 背景音乐路径java.lang.IllegalStateException
public void stopBGMAsync() throws java.lang.IllegalStateException
ILivePusher
stopBGMAsync
in interface ILivePusher
java.lang.IllegalStateException
public void pauseBGM() throws java.lang.IllegalStateException
ILivePusher
pauseBGM
in interface ILivePusher
java.lang.IllegalStateException
public void resumeBGM() throws java.lang.IllegalStateException
ILivePusher
resumeBGM
in interface ILivePusher
java.lang.IllegalStateException
public void setBGMLoop(boolean isLoop) throws java.lang.IllegalStateException
ILivePusher
setBGMLoop
in interface ILivePusher
isLoop
- 是否循环 true:循环 false:不循环java.lang.IllegalStateException
public void setBGMEarsBack(boolean isOpen) throws java.lang.IllegalStateException
ILivePusher
setBGMEarsBack
in interface ILivePusher
isOpen
- 是否循环 true:开启耳返 false:关闭耳返java.lang.IllegalStateException
public void setBGMVolume(int volume) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
ILivePusher
setBGMVolume
in interface ILivePusher
volume
- 人声音量大小 范围:[0 ~ 100] 默认:50java.lang.IllegalStateException
java.lang.IllegalArgumentException
public void setCaptureVolume(int volume) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
ILivePusher
setCaptureVolume
in interface ILivePusher
volume
- 音乐音量大小 范围:[0 ~ 100] 默认:50java.lang.IllegalStateException
java.lang.IllegalArgumentException
public void setAudioDenoise(boolean on)
ILivePusher
setAudioDenoise
in interface ILivePusher
on
- true:开启 false:关闭public int startIntelligentDenoise()
ILivePusher
1、使用智能降噪,请关闭普通降噪;两者功能互斥使用 2、智能降噪功能以插件形式提供,调用该接口前,请确保已集成了libpluginAliDenoise.so;插件获取方式请参考官网文档; 3、此接口可以通话过程中控制打开智能降噪功能,通话过程中可以支持开启和关闭智能降噪 4、默认关闭,开启后可能导致功耗增加,智能降噪适合于会议,教育等语音通讯为主的场景,不适合有背景音乐的场景
注意事项!!! 如遇libMNN相关的so冲突,请检查当前工程中是否使用到了视频云的其它产品,如美颜SDK/Animoji SDK 美颜SDK/Animoji SDK中,包含libMNN相关的so,因此外部无需再导入一份,只保留libpluginAliDenoise.so, 全局MNN相关的库,统一留一份即可; 具体请查看官网文档或API文档,或者您可以咨询技术同学协助解决问题;
startIntelligentDenoise
in interface ILivePusher
public int stopIntelligentDenoise()
ILivePusher
此接口可以通话过程中控制关闭智能降噪功能
stopIntelligentDenoise
in interface ILivePusher
public void setQualityMode(AlivcQualityModeEnum mode) throws java.lang.IllegalStateException
ILivePusher
setQualityMode
in interface ILivePusher
java.lang.IllegalStateException
public void setPreviewMode(AlivcPreviewDisplayMode mode) throws java.lang.IllegalStateException
ILivePusher
setPreviewMode
in interface ILivePusher
java.lang.IllegalStateException
public void pauseScreenCapture() throws java.lang.IllegalStateException
ILivePusher
pauseScreenCapture
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPush/已经pausepublic void resumeScreenCapture() throws java.lang.IllegalStateException
ILivePusher
resumeScreenCapture
in interface ILivePusher
java.lang.IllegalStateException
- 如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resumepublic AlivcLivePushError getLastError()
ILivePusher
getLastError
in interface ILivePusher
public void changeResolution(AlivcResolutionEnum resolutionEnum)
ILivePusher
changeResolution
in interface ILivePusher
public void addWaterMark(java.lang.String path, float x, float y, float width)
ILivePusher
addWaterMark
in interface ILivePusher
path
- 水印图片x
- 水印左上角x轴位置 相对位置 0~1y
- 水印右上角y轴位置 相对位置 0~1width
- 水印显示宽度 相对位置 0~1public void setWatermarkVisible(boolean visible)
ILivePusher
setWatermarkVisible
in interface ILivePusher
visible
- 是否可见public int startCamera(android.view.SurfaceView surfaceView) throws java.lang.IllegalStateException
ILivePusher
startCamera
in interface ILivePusher
java.lang.IllegalStateException
public void stopCamera()
ILivePusher
stopCamera
in interface ILivePusher
public void setScreenOrientation(int orientation)
ILivePusher
setScreenOrientation
in interface ILivePusher
public int startCameraMix(float x, float y, float w, float h)
ILivePusher
startCameraMix
in interface ILivePusher
x
- 混流显示x初始位置(0~1.0f)y
- 混流显示y初始位置(0~1.0f)w
- 混流显示宽度(0~1.0f)h
- 混流显示高度(0~1.0f)public void stopCameraMix()
ILivePusher
stopCameraMix
in interface ILivePusher
public void snapshot(int count, int interval, AlivcSnapshotListener listener)
ILivePusher
snapshot
in interface ILivePusher
count
- 截取图片的个数,该参数仅在普通模式下生效!!!interval
- 每张图片的间隔,该参数仅在普通模式下生效!!!listener
- 截图回调public void inputStreamVideoPtr(long dataptr, int width, int height, int stride, int size, long pts, int rotation)
ILivePusher
inputStreamVideoPtr
in interface ILivePusher
dataptr
- 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)
ILivePusher
inputStreamVideoData
in interface ILivePusher
data
- 视频图像byte arraywidth
- 视频图像宽度height
- 视频图像高度size
- 视频图像sizepts
- 视频图像pts(us)rotation
- 视频图像旋转角度public void inputStreamAudioPtr(long dataPtr, int size, int sampleRate, int channels, long pts)
ILivePusher
inputStreamAudioPtr
in interface ILivePusher
dataPtr
- 音频数据native内存指针pts
- 音频数据pts(US)public void inputStreamAudioData(byte[] data, int size, int sampleRate, int channels, long pts)
ILivePusher
inputStreamAudioData
in interface ILivePusher
data
- 音频数据 byte arraypts
- 音频数据pts(US)public int addDynamicsAddons(java.lang.String path, float x, float y, float w, float h)
ILivePusher
addDynamicsAddons
in interface ILivePusher
path
- 贴纸路径,带config.jsonx
- 显示起始x位置(0~1.0f)y
- 显示起始y位置(0~1.0f)w
- 显示宽度(0~1.0f)h
- 显示高度(0~1.0f)public void removeDynamicsAddons(int id)
ILivePusher
removeDynamicsAddons
in interface ILivePusher
id
- 贴纸idpublic void setExposure(int exposure)
ILivePusher
setExposure
in interface ILivePusher
public int getCurrentExposure()
ILivePusher
getCurrentExposure
in interface ILivePusher
public int getSupportedMinExposure()
ILivePusher
getSupportedMinExposure
in interface ILivePusher
public int getSupportedMaxExposure()
ILivePusher
getSupportedMaxExposure
in interface ILivePusher
public void sendMessage(java.lang.String info, int repeat, int delay, boolean isKeyFrame)
ILivePusher
sendMessage
in interface ILivePusher
info
- 需要插入流的SEI消息体,建议是json格式repeat
- 发送的帧数delay
- 延时多少毫秒发送isKeyFrame
- 是否只发送关键帧public int setLiveMixTranscodingConfig(AlivcLiveTranscodingConfig config)
ILivePusher
setLiveMixTranscodingConfig
in interface ILivePusher
config
- 参考AlivcLiveDef.h中关于AlivcLiveTranscodingConfig的介绍,如果传入nil,则取消云端混流转码public java.lang.String getLiveTraceId()
ILivePusher
getLiveTraceId
in interface ILivePusher