AliVCSDK 6.8.0
阿里云音视频SDK,为视频开发者提供一站式接入服务
 
载入中...
搜索中...
未找到
com.alivc.live.pusher.AlivcLivePusher类 参考

「主要API」推流接口类 更多...

类 com.alivc.live.pusher.AlivcLivePusher 继承关系图:

Public 成员函数

void init (Context context, AlivcLivePushConfig config) throws IllegalArgumentException, IllegalStateException
 
void destroy () throws IllegalStateException
 
void setLivePusherReference (AlivcLivePusher livePusher)
 
void startPreview (SurfaceView surfaceView) throws IllegalArgumentException, IllegalStateException
 
void startPreviewAsync (SurfaceView surfaceView) throws IllegalArgumentException, IllegalStateException
 
void startPreview (Context context, FrameLayout frameLayout, boolean isAnchor) throws IllegalArgumentException, IllegalStateException
 
void updatePreview (Context context, FrameLayout frameLayout, boolean isAnchor)
 
void stopPreview () throws IllegalStateException
 
void startPush (String url) throws IllegalArgumentException, IllegalStateException
 
void startPushAsync (String url) throws IllegalArgumentException, IllegalStateException
 
void restartPush () throws IllegalStateException
 
void restartPushAsync () throws IllegalStateException
 
void reconnectPushAsync (String url) throws IllegalStateException
 
void stopPush () throws IllegalStateException
 
void pause () throws IllegalStateException
 
void resume () throws IllegalStateException
 
void resumeAsync () throws IllegalStateException
 
void switchCamera () throws IllegalStateException
 
void setAutoFocus (boolean autoFocus) throws IllegalStateException
 
void focusCameraAtAdjustedPoint (float x, float y, boolean autoFocus) throws IllegalArgumentException, IllegalStateException
 
void setZoom (int zoom) throws IllegalArgumentException, IllegalStateException
 
int getMaxZoom () throws IllegalStateException
 
int getCurrentZoom () throws IllegalStateException
 
void setMute (boolean mute) throws IllegalStateException
 
void setFlash (boolean flash) throws IllegalStateException
 
void setPushMirror (boolean mirror) throws IllegalStateException
 
void setPreviewMirror (boolean mirror) throws IllegalStateException
 
void setTargetVideoBitrate (int targetVideoBitrate) throws IllegalArgumentException, IllegalStateException
 
void setMinVideoBitrate (int minVideoBitrate) throws IllegalArgumentException, IllegalStateException
 
void refreshPushURLToken (String url)
 
boolean isCameraSupportAutoFocus ()
 
boolean isCameraSupportFlash ()
 
boolean isPushing () throws IllegalStateException
 
boolean isNetworkPushing () throws IllegalStateException
 
void setCustomDetect (AlivcLivePushCustomDetect customVideoDetect)
 
void setCustomFilter (AlivcLivePushCustomFilter customVideoFilter)
 
void setCustomAudioFilter (AlivcLivePushCustomAudioFilter customAudioFilter)
 
AlivcLivePushStats getCurrentStatus ()
 
void setLivePushErrorListener (AlivcLivePushErrorListener errorListener)
 
void setLivePushInfoListener (AlivcLivePushInfoListener infoListener)
 
void setLivePushNetworkListener (AlivcLivePushNetworkListener networkListener)
 
void setLivePushBGMListener (AlivcLivePushBGMListener pushBGMListener)
 
void setLivePushRenderContextListener (AlivcLivePusherRenderContextListener renderCtxListener)
 
AlivcLivePushStatsInfo getLivePushStatsInfo () throws IllegalStateException
 
String getPushUrl ()
 
void setPreviewOrientation (AlivcPreviewOrientationEnum orientation)
 
int setAudioEffectVoiceChangeMode (AlivcLivePushAudioEffectVoiceChangeMode mode)
 
int setAudioEffectReverbMode (AlivcLivePushAudioEffectReverbMode mode)
 
int startBGMAsync (String path) throws IllegalStateException
 
int startBGMAsync (String path, AlivcLiveBGMConfig bgmConfig)
 
void stopBGMAsync () throws IllegalStateException
 
void pauseBGM () throws IllegalStateException
 
void resumeBGM () throws IllegalStateException
 
void setBGMLoop (boolean isLoop) throws IllegalStateException
 
void setBGMEarsBack (boolean isOpen) throws IllegalStateException
 
void setBGMVolume (int volume) throws IllegalStateException, IllegalArgumentException
 
void setCaptureVolume (int volume) throws IllegalStateException, IllegalArgumentException
 
void setAudioDenoise (boolean enable)
 
int startIntelligentDenoise ()
 
int stopIntelligentDenoise ()
 
void setQualityMode (AlivcQualityModeEnum mode) throws IllegalStateException
 
void setPreviewMode (AlivcPreviewDisplayMode mode) throws IllegalStateException
 
void pauseScreenCapture () throws IllegalStateException
 
void resumeScreenCapture () throws IllegalStateException
 
AlivcEncodeType getVideoCodecType ()
 
AlivcLivePushError getLastError ()
 
void changeResolution (AlivcResolutionEnum resolution)
 
void addWaterMark (String path, float x, float y, float width)
 
void addWaterMark (Bitmap bitmap, float x, float y, float width)
 
void setWatermarkVisible (boolean visible)
 
int startCamera (SurfaceView surfaceView) throws IllegalStateException
 
void stopCamera ()
 
void setScreenOrientation (int orientation)
 
int startCameraMix (float x, float y, float w, float h)
 
void stopCameraMix ()
 
boolean startLocalRecord (AlivcLiveLocalRecordConfig localRecordConfig)
 
void stopLocalRecord ()
 
int startScreenShare ()
 
int stopScreenShare ()
 
void snapshot (int count, int interval, AlivcSnapshotListener listener)
 
void setExternalVideoSource (boolean enable, boolean useTexture, AlivcLivePlayVideoStreamType videoStreamType, AlivcPreviewDisplayMode previewDisplayMode)
 
int setMixedWithMic (boolean mixed)
 
int addExternalAudioStream (AlivcLivePushExternalAudioStreamConfig externalAudioStreamConfig)
 
int pushExternalAudioStream (int streamId, AlivcLivePusherAudioDataSample audioDataSample)
 
int setExternalAudioStreamPlayoutVolume (int streamId, int playoutVolume)
 
int setExternalAudioStreamPublishVolume (int streamId, int publishVolume)
 
int removeExternalAudioStream (int streamId)
 
void inputStreamVideoPtr (long dataPtr, int width, int height, int stride, int size, long pts, int rotation)
 
void inputStreamVideoData (byte[] data, int width, int height, int stride, int size, long pts, int rotation)
 
void inputStreamAudioPtr (long dataPtr, int size, int sampleRate, int channels, long pts)
 
void inputStreamAudioData (byte[] data, int size, int sampleRate, int channels, long pts)
 
int addDynamicsAddons (String path, float x, float y, float w, float h)
 
void removeDynamicsAddons (int id)
 
void setExposure (int exposure)
 
int getCurrentExposure ()
 
int getSupportedMinExposure ()
 
int getSupportedMaxExposure ()
 
void sendMessage (String info, int repeat, int delay, boolean isKeyFrame)
 
int sendDataChannelMessage (String message)
 
int setLiveMixTranscodingConfig (AlivcLiveTranscodingConfig config)
 
int muteLocalCamera (boolean mute)
 
int enableLocalCamera (boolean enable)
 
int startAudioCapture (boolean keepAlive)
 
int stopAudioCapture ()
 
int enableSpeakerphone (boolean enable)
 
boolean isSpeakerphoneOn ()
 
int setChannelProfile (AlivcLiveChannelProfile channelProfile)
 
int setAudioProfile (AlivcLiveAudioProfileQualityMode audioProfileQualityMode)
 
int setAudioEffectPitchValue (double value)
 
int setAudioEffectBeautifyMode (AlivcLiveAudioEffectBeautifyMode audioEffectBeautifyMode)
 
int setAudioEffectReverbParamType (AlivcLiveAudioEffectReverbParamType audioEffectReverbParamType, float value)
 
int setAudioEffectEqualizationParam (AlivcLiveAudioEffectEqualizationBandFrequency audioEffectEqualizationBandFrequency, float gain)
 
int enableAudioVolumeIndication (int interval, int smooth, int reportVad)
 
int startLastMileDetect (AlivcLiveNetworkQualityProbeConfig networkQualityProbeConfig)
 
int stopLastMileDetect ()
 
String getLiveTraceId ()
 

详细描述

「主要API」推流接口类

作者
阿里云直播推流SDK
日期
2017/10/8
注解
客户需要自行声明并申请 READ_PHONE_STATE 权限,否则接听电话时推流静音的功能将不生效!
参见
com.alivc.live.pusher.AlivcLivePushConfig
com.alivc.live.annotations.AlivcLiveMode
推流SDK文档
直播连麦文档
直播控制台操作指南

在文件 AlivcLivePusher.java43 行定义.

成员函数说明

◆ addDynamicsAddons()

int com.alivc.live.pusher.AlivcLivePusher.addDynamicsAddons ( String  path,
float  x,
float  y,
float  w,
float  h 
)

添加动态贴纸

参数
path贴纸路径,带config.json
x显示起始x位置(0~1.0f)
y显示起始y位置(0~1.0f)
w显示宽度(0~1.0f)
h显示高度(0~1.0f)
返回
id 贴纸id

在文件 AlivcLivePusher.java1418 行定义.

◆ addExternalAudioStream()

int com.alivc.live.pusher.AlivcLivePusher.addExternalAudioStream ( AlivcLivePushExternalAudioStreamConfig  externalAudioStreamConfig)

新增外部音频流

参数
externalAudioStreamConfig外部音频流配置
返回
0->成功, 非0->失败
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1255 行定义.

◆ addWaterMark() [1/2]

void com.alivc.live.pusher.AlivcLivePusher.addWaterMark ( Bitmap  bitmap,
float  x,
float  y,
float  width 
)

添加水印,起点位置坐标x[0,width) y[0, height) 宽度(0, width]

参数
bitmap水印bitmap(格式:rgba)
x水印左上角x轴位置 相对位置 0~1
y水印右上角y轴位置 相对位置 0~1
width水印显示宽度 相对位置 0~1
注解
需在startPreview之后调用
互动模式下使用该接口添加水印
最多添加一个,多则替代

在文件 AlivcLivePusher.java1054 行定义.

◆ addWaterMark() [2/2]

void com.alivc.live.pusher.AlivcLivePusher.addWaterMark ( String  path,
float  x,
float  y,
float  width 
)

添加水印,起点位置坐标x[0,width) y[0,height) 宽度(0,width],最多添加3个

参数
path水印图片
x水印左上角x轴位置 相对位置 0~1
y水印右上角y轴位置 相对位置 0~1
width水印显示宽度 相对位置 0~1
注解
需在startPreview之后调用
基础模式下使用该接口添加水印

在文件 AlivcLivePusher.java1035 行定义.

◆ changeResolution()

void com.alivc.live.pusher.AlivcLivePusher.changeResolution ( AlivcResolutionEnum  resolution)

动态调整分辨率

参数
resolution分辨率

在文件 AlivcLivePusher.java1017 行定义.

◆ destroy()

void com.alivc.live.pusher.AlivcLivePusher.destroy ( ) throws IllegalStateException

销毁推流引擎

异常
IllegalStateException如果状态不对,例如还未初始化

在文件 AlivcLivePusher.java96 行定义.

◆ enableAudioVolumeIndication()

int com.alivc.live.pusher.AlivcLivePusher.enableAudioVolumeIndication ( int  interval,
int  smooth,
int  reportVad 
)

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

参数
interval时间间隔,单位:ms,默认值:300ms;取值范围:最小值≥10ms,建议设置为300ms~500ms;取值≤0表示不启用音量提示和说话人提示功能。
smooth平滑系数,数值越大平滑程度越高,反之越低,实时性越好。默认值:3;取值范围:0~9,建议设置为3。
reportVad本地语音检测开关。1:开启,通过 AlivcLivePushInfoListener#onMicrophoneVolumeUpdate(AlivcLivePusher, int) 接口回调;0(默认值):关闭。
返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果
注解
调用此接口后,会开启vad功能,以下回调才会生效:
参见
AlivcLivePushInfoListener::onMicrophoneVolumeUpdate(AlivcLivePusher, int)
com.alivc.live.player.AlivcLivePlayInfoListener::onPlayoutVolumeUpdate(int, boolean)

在文件 AlivcLivePusher.java1760 行定义.

◆ enableLocalCamera()

int com.alivc.live.pusher.AlivcLivePusher.enableLocalCamera ( boolean  enable)

禁用或启用本地视频采集

参数
enabletrue->启用本地视频采集,false->关闭本地视频采集
返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果
注解
调用此接口,视频采集会被关闭
如果仅需关闭摄像头,不关闭视频采集,请参考以下接口:
参见
AlivcLivePusher::muteLocalCamera(boolean)

在文件 AlivcLivePusher.java1578 行定义.

◆ enableSpeakerphone()

int com.alivc.live.pusher.AlivcLivePusher.enableSpeakerphone ( boolean  enable)

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

参数
enabletrue:扬声器模式(默认扬声器);false:听筒模式
返回
0 -> 成功,<0 -> 失败
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1628 行定义.

◆ focusCameraAtAdjustedPoint()

void com.alivc.live.pusher.AlivcLivePusher.focusCameraAtAdjustedPoint ( float  x,
float  y,
boolean  autoFocus 
) throws IllegalArgumentException, IllegalStateException

对焦,对焦点的坐标x[0,屏幕宽度],y[0,屏幕宽度]

参数
x对焦的点x坐标
y对焦的点y坐标y
autoFocus是否自动聚焦
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java353 行定义.

◆ getCurrentExposure()

int com.alivc.live.pusher.AlivcLivePusher.getCurrentExposure ( )

获取当前采集曝光

返回
当前采集曝光

在文件 AlivcLivePusher.java1457 行定义.

◆ getCurrentStatus()

AlivcLivePushStats com.alivc.live.pusher.AlivcLivePusher.getCurrentStatus ( )

获取当前状态

返回
当前状态

在文件 AlivcLivePusher.java605 行定义.

◆ getCurrentZoom()

int com.alivc.live.pusher.AlivcLivePusher.getCurrentZoom ( ) throws IllegalStateException

获取当前缩放值

返回
当前缩放值
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java395 行定义.

◆ getLastError()

AlivcLivePushError com.alivc.live.pusher.AlivcLivePusher.getLastError ( )

获取最近的错误值

返回
错误

在文件 AlivcLivePusher.java1004 行定义.

◆ getLivePushStatsInfo()

AlivcLivePushStatsInfo com.alivc.live.pusher.AlivcLivePusher.getLivePushStatsInfo ( ) throws IllegalStateException

获取推流统计数据

返回
推流统计数据
异常
IllegalStateException如果状态不对,例如还未初始化

在文件 AlivcLivePusher.java684 行定义.

◆ getLiveTraceId()

String com.alivc.live.pusher.AlivcLivePusher.getLiveTraceId ( )

获取直播trace id

返回
trace id
注意
非基础模式暂不支持该API,调用返回空字符串

在文件 AlivcLivePusher.java1808 行定义.

◆ getMaxZoom()

int com.alivc.live.pusher.AlivcLivePusher.getMaxZoom ( ) throws IllegalStateException

获取摄像头支持的最大缩放值

返回
最大zoom值
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java381 行定义.

◆ getPushUrl()

String com.alivc.live.pusher.AlivcLivePusher.getPushUrl ( )

获取推流URL

返回
推流URL

在文件 AlivcLivePusher.java697 行定义.

◆ getSupportedMaxExposure()

int com.alivc.live.pusher.AlivcLivePusher.getSupportedMaxExposure ( )

获取采集支持最大曝光

返回
采集支持最大曝光

在文件 AlivcLivePusher.java1483 行定义.

◆ getSupportedMinExposure()

int com.alivc.live.pusher.AlivcLivePusher.getSupportedMinExposure ( )

获取采集支持最小曝光

返回
采集支持最小曝光

在文件 AlivcLivePusher.java1470 行定义.

◆ getVideoCodecType()

AlivcEncodeType com.alivc.live.pusher.AlivcLivePusher.getVideoCodecType ( )

获取当前视频编码格式

返回
当前视频编码格式
参见
AlivcEncodeType

在文件 AlivcLivePusher.java991 行定义.

◆ init()

void com.alivc.live.pusher.AlivcLivePusher.init ( Context  context,
AlivcLivePushConfig  config 
) throws IllegalArgumentException, IllegalStateException

初始化推流引擎

参数
contextandroid context
config推流配置
异常
IllegalArgumentException如果配置为空,或者配置值无效(例如码率的值超过范围)
IllegalStateException如果状态不对,例如已经初始化,但是还没有销毁

在文件 AlivcLivePusher.java58 行定义.

◆ inputStreamAudioData()

void com.alivc.live.pusher.AlivcLivePusher.inputStreamAudioData ( byte[]  data,
int  size,
int  sampleRate,
int  channels,
long  pts 
)

输入自定义音频数据

参数
data音频数据 byte array
size音频数据大小
sampleRate音频比特率
channels音频通道数
pts音频数据pts(US)
注解
调用前需要通配置AlivcLivePushConfig::setExternMainStream开启外置自定义输入流才会起作用
参见
com.alivc.live.pusher.AlivcLivePushConfig::setExternMainStream(boolean, com.alivc.live.pusher.AlivcImageFormat, com.alivc.live.pusher.AlivcSoundFormat)

在文件 AlivcLivePusher.java1400 行定义.

◆ inputStreamAudioPtr()

void com.alivc.live.pusher.AlivcLivePusher.inputStreamAudioPtr ( long  dataPtr,
int  size,
int  sampleRate,
int  channels,
long  pts 
)

输入自定义音频数据 (deprecated)

参数
dataPtr音频数据native内存指针
size音频数据大小
sampleRate音频比特率
channels音频通道数
pts音频数据pts(US)
注解
调用前需要通配置AlivcLivePushConfig::setExternMainStream开启外置自定义输入流才会起作用
参见
com.alivc.live.pusher.AlivcLivePushConfig::setExternMainStream(boolean, com.alivc.live.pusher.AlivcImageFormat, com.alivc.live.pusher.AlivcSoundFormat)

在文件 AlivcLivePusher.java1381 行定义.

◆ inputStreamVideoData()

void com.alivc.live.pusher.AlivcLivePusher.inputStreamVideoData ( byte[]  data,
int  width,
int  height,
int  stride,
int  size,
long  pts,
int  rotation 
)

输入自定义视频流

参数
data视频图像byte array
width视频图像宽度
height视频图像高度
stride视频图像stride
size视频图像size
pts视频图像pts(us)
rotation视频图像旋转角度
注解
Before calling, it is necessary to configure AlivcLivePushConfig::setExternMainStream to enable an external custom input stream before it can take effect
参见
com.alivc.live.pusher.AlivcLivePushConfig::setExternMainStream(boolean, com.alivc.live.pusher.AlivcImageFormat, com.alivc.live.pusher.AlivcSoundFormat)

在文件 AlivcLivePusher.java1361 行定义.

◆ inputStreamVideoPtr()

void com.alivc.live.pusher.AlivcLivePusher.inputStreamVideoPtr ( long  dataPtr,
int  width,
int  height,
int  stride,
int  size,
long  pts,
int  rotation 
)

输入自定义视频流 (deprecated)

参数
dataPtrnative内存指针
width视频图像宽度
height视频图像高度
stride视频图像高度
size视频图像size
pts视频图像pts(us)
rotation视频图像旋转角度
注解
调用前需要通配置AlivcLivePushConfig::setExternMainStream开启外置自定义输入流才会起作用

在文件 AlivcLivePusher.java1340 行定义.

◆ isCameraSupportAutoFocus()

boolean com.alivc.live.pusher.AlivcLivePusher.isCameraSupportAutoFocus ( )

获取是否支持自动对焦

返回
是否支持自动对焦

在文件 AlivcLivePusher.java512 行定义.

◆ isCameraSupportFlash()

boolean com.alivc.live.pusher.AlivcLivePusher.isCameraSupportFlash ( )

获取是否支持闪光灯

返回
是否支持闪光灯

在文件 AlivcLivePusher.java525 行定义.

◆ isNetworkPushing()

boolean com.alivc.live.pusher.AlivcLivePusher.isNetworkPushing ( ) throws IllegalStateException

获取当前网络推流状态

返回
当前网络推流状态
异常
IllegalStateException

在文件 AlivcLivePusher.java553 行定义.

◆ isPushing()

boolean com.alivc.live.pusher.AlivcLivePusher.isPushing ( ) throws IllegalStateException

是否正在推流

返回
true:正在推流 false:未推流
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush

在文件 AlivcLivePusher.java539 行定义.

◆ isSpeakerphoneOn()

boolean com.alivc.live.pusher.AlivcLivePusher.isSpeakerphoneOn ( )

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

返回
true->扬声器模式,false->听筒模式
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1642 行定义.

◆ muteLocalCamera()

int com.alivc.live.pusher.AlivcLivePusher.muteLocalCamera ( boolean  mute)

关闭/打开摄像头

参数
mutetrue->不发送视频数据,false->恢复正常
返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果
注解
如果当前已设置AlivcLivePushConfig::setPausePushImage,采集预览正常,对端显示静态图片;
如果当前未设置AlivcLivePushConfig::setPausePushImage,采集预览正常,对端会黑屏;
调用此接口,发送黑色的视频帧;采集,编码,发送模块仍然工作,只是视频内容是黑色帧
如果需要关闭视频采集,请参考以下接口:
参见
AlivcLivePusher::enableLocalCamera(boolean)

在文件 AlivcLivePusher.java1560 行定义.

◆ pause()

void com.alivc.live.pusher.AlivcLivePusher.pause ( ) throws IllegalStateException

暂停推流

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush/已经pause

在文件 AlivcLivePusher.java284 行定义.

◆ pauseBGM()

void com.alivc.live.pusher.AlivcLivePusher.pauseBGM ( ) throws IllegalStateException

暂停播放背景音乐

异常
IllegalStateException状态错误

在文件 AlivcLivePusher.java799 行定义.

◆ pauseScreenCapture()

void com.alivc.live.pusher.AlivcLivePusher.pauseScreenCapture ( ) throws IllegalStateException

暂停录屏推流(隐私开)

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush/已经pause

在文件 AlivcLivePusher.java964 行定义.

◆ pushExternalAudioStream()

int com.alivc.live.pusher.AlivcLivePusher.pushExternalAudioStream ( int  streamId,
AlivcLivePusherAudioDataSample  audioDataSample 
)

输入外部音频流数据

参数
streamId外部音频流Id
audioDataSample外部音频裸数据
注意
非互动模式暂不支持该API,调用无任何效果
注解
为了保证语音连续性,sdk内部会有buffer缓存送进来的音频数据,以每次送10ms数据为例,如果返回0x01070101时,说明内部缓冲区已满,建议等待20ms后再重新送当前数据帧
返回
0->成功, <0->失败

在文件 AlivcLivePusher.java1272 行定义.

◆ reconnectPushAsync()

void com.alivc.live.pusher.AlivcLivePusher.reconnectPushAsync ( String  url) throws IllegalStateException

重新连接进行推流

参数
url推流URL
异常
IllegalStateException例如还未初始化/未startPreview/未startPush/已经stopPush

在文件 AlivcLivePusher.java258 行定义.

◆ refreshPushURLToken()

void com.alivc.live.pusher.AlivcLivePusher.refreshPushURLToken ( String  url)

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

参数
url推流Url
注意
非互动模式暂不支持该API,调用无任何效果
注解
该方法用于更新鉴权信息推流URL中的token信息,主要为了防止鉴权过期,导致推流失败;
当我们收到 AlivcLivePushNetworkListener#onPushURLAuthenticationOverdue(AlivcLivePusher) 回调时,外部应当更新鉴权信息,否则会导致断流

在文件 AlivcLivePusher.java499 行定义.

◆ removeDynamicsAddons()

void com.alivc.live.pusher.AlivcLivePusher.removeDynamicsAddons ( int  id)

删除动态贴纸

参数
id贴纸id

在文件 AlivcLivePusher.java1431 行定义.

◆ removeExternalAudioStream()

int com.alivc.live.pusher.AlivcLivePusher.removeExternalAudioStream ( int  streamId)

删除外部音频流

参数
streamId外部音频流Id
返回
0->成功, 非0->失败
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1319 行定义.

◆ restartPush()

void com.alivc.live.pusher.AlivcLivePusher.restartPush ( ) throws IllegalStateException

重新开始推流

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPush

在文件 AlivcLivePusher.java231 行定义.

◆ restartPushAsync()

void com.alivc.live.pusher.AlivcLivePusher.restartPushAsync ( ) throws IllegalStateException

重新开始推流

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPush

在文件 AlivcLivePusher.java244 行定义.

◆ resume()

void com.alivc.live.pusher.AlivcLivePusher.resume ( ) throws IllegalStateException

恢复推流

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resume

在文件 AlivcLivePusher.java297 行定义.

◆ resumeAsync()

void com.alivc.live.pusher.AlivcLivePusher.resumeAsync ( ) throws IllegalStateException

异步恢复推流

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resume

在文件 AlivcLivePusher.java310 行定义.

◆ resumeBGM()

void com.alivc.live.pusher.AlivcLivePusher.resumeBGM ( ) throws IllegalStateException

恢复播放背景音乐

异常
IllegalStateException状态错误

在文件 AlivcLivePusher.java812 行定义.

◆ resumeScreenCapture()

void com.alivc.live.pusher.AlivcLivePusher.resumeScreenCapture ( ) throws IllegalStateException

恢复录屏推流(隐私关)

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resume

在文件 AlivcLivePusher.java977 行定义.

◆ sendDataChannelMessage()

int com.alivc.live.pusher.AlivcLivePusher.sendDataChannelMessage ( String  message)

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

参数
message自定义消息
注意
非互动模式暂不支持该API,调用无任何效果
注解
需通过调用 com.alivc.live.pusher.AlivcLivePushConfig#setEnableDataChannelMessage(boolean) 接口开启功能
接收端在 com.alivc.live.player.AlivcLivePlayInfoListener#onReceiveDataChannelMessage(byte[]) 回调接收消息
参见
com.alivc.live.pusher.AlivcLivePushConfig::setEnableDataChannelMessage(boolean)
com.alivc.live.player.AlivcLivePlayInfoListener::onReceiveDataChannelMessage(byte[])

在文件 AlivcLivePusher.java1517 行定义.

◆ sendMessage()

void com.alivc.live.pusher.AlivcLivePusher.sendMessage ( String  info,
int  repeat,
int  delay,
boolean  isKeyFrame 
)

推流端发送自定义消息

参数
info需要插入流的SEI消息体,建议是json格式
repeat发送的帧数
delay延时多少毫秒发送
isKeyFrame是否只发送关键帧

在文件 AlivcLivePusher.java1499 行定义.

◆ setAudioDenoise()

void com.alivc.live.pusher.AlivcLivePusher.setAudioDenoise ( boolean  enable)

设置音频降噪

参数
enabletrue:开启 false:关闭
注解
使用普通降噪,请关闭智能降噪;两者功能互斥使用
音频智能降噪请参考以下接口:
参见
AlivcLivePusher::startIntelligentDenoise()

在文件 AlivcLivePusher.java886 行定义.

◆ setAudioEffectBeautifyMode()

int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectBeautifyMode ( AlivcLiveAudioEffectBeautifyMode  audioEffectBeautifyMode)

设置美声音效模式

参数
audioEffectBeautifyMode美声模式
返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果
参见
com.alivc.live.annotations.AlivcLiveAudioEffectBeautifyMode

在文件 AlivcLivePusher.java1705 行定义.

◆ setAudioEffectEqualizationParam()

int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectEqualizationParam ( AlivcLiveAudioEffectEqualizationBandFrequency  audioEffectEqualizationBandFrequency,
float  gain 
)

设置均衡器参数

参数
audioEffectEqualizationBandFrequency均衡器段数 [0,9],中心频率 [31,62,125,250,500,1000,2000,4000,8000,16000] Hz
gain均衡器增益db [-15,15],默认 0
返回
0 -> success,not 0 -> failed
注意
非互动模式暂不支持该API,调用无任何效果
注解
需要在 AlivcLivePusher::setAudioEffectBeautifyMode 后调用
参见
com.alivc.live.annotations.AlivcLiveAudioEffectEqualizationBandFrequency

在文件 AlivcLivePusher.java1740 行定义.

◆ setAudioEffectPitchValue()

int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectPitchValue ( double  value)

设置变调参数

参数
value变调参数
返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果
注解
范围:[0.5, 2.0],1.0表示音调不变,小于1.0表示音调降低,大于1.0表示音调升高,默认1.0

在文件 AlivcLivePusher.java1689 行定义.

◆ setAudioEffectReverbMode()

int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectReverbMode ( AlivcLivePushAudioEffectReverbMode  mode)

设置混响音效模式

参数
mode混响音效模式
返回
0->成功, 非0->失败
注解
推流前和推流过程中调用都生效
参见
AlivcLivePushAudioEffectReverbMode

在文件 AlivcLivePusher.java742 行定义.

◆ setAudioEffectReverbParamType()

int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectReverbParamType ( AlivcLiveAudioEffectReverbParamType  audioEffectReverbParamType,
float  value 
)

设置混响音效类型

参数
audioEffectReverbParamType混响音效类型
返回
0 -> success,not 0 -> failed
注意
非互动模式暂不支持该API,调用无任何效果
注解
需要在AlivcLivePusher#setAudioEffectReverbMode后调用
参见
com.alivc.live.annotations.AlivcLiveAudioEffectReverbParamType

在文件 AlivcLivePusher.java1722 行定义.

◆ setAudioEffectVoiceChangeMode()

int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectVoiceChangeMode ( AlivcLivePushAudioEffectVoiceChangeMode  mode)

设置变声音效模式

参数
mode变声音效模式
返回
0->成功, 非0->失败
注解
推流前和推流过程中调用都生效
参见
AlivcLivePushAudioEffectVoiceChangeMode

在文件 AlivcLivePusher.java726 行定义.

◆ setAudioProfile()

int com.alivc.live.pusher.AlivcLivePusher.setAudioProfile ( AlivcLiveAudioProfileQualityMode  audioProfileQualityMode)

设置音频profile

参数
audioProfileQualityMode音频profile
返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1673 行定义.

◆ setAutoFocus()

void com.alivc.live.pusher.AlivcLivePusher.setAutoFocus ( boolean  autoFocus) throws IllegalStateException

设置自动对焦

参数
autoFocus自动聚焦
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java337 行定义.

◆ setBGMEarsBack()

void com.alivc.live.pusher.AlivcLivePusher.setBGMEarsBack ( boolean  isOpen) throws IllegalStateException

设置耳返开关

参数
isOpen是否开启
异常
IllegalStateException状态错误

在文件 AlivcLivePusher.java840 行定义.

◆ setBGMLoop()

void com.alivc.live.pusher.AlivcLivePusher.setBGMLoop ( boolean  isLoop) throws IllegalStateException

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

参数
isLoop是否循环
异常
IllegalStateException状态错误

在文件 AlivcLivePusher.java826 行定义.

◆ setBGMVolume()

void com.alivc.live.pusher.AlivcLivePusher.setBGMVolume ( int  volume) throws IllegalStateException, IllegalArgumentException

设置背景音乐音量

参数
volume背景音乐音量 范围:[0 ~ 100] 默认:50
异常
IllegalStateException状态错误
IllegalArgumentException参数错误

在文件 AlivcLivePusher.java855 行定义.

◆ setCaptureVolume()

void com.alivc.live.pusher.AlivcLivePusher.setCaptureVolume ( int  volume) throws IllegalStateException, IllegalArgumentException

设置人声音量

参数
volume人声音量 范围:[0 ~ 100] 默认:50
异常
IllegalStateException状态错误
IllegalArgumentException参数错误

在文件 AlivcLivePusher.java870 行定义.

◆ setChannelProfile()

int com.alivc.live.pusher.AlivcLivePusher.setChannelProfile ( AlivcLiveChannelProfile  channelProfile)

设置频道模式

参数
channelProfile频道模式类型,默认INTERACTIVE_LIVE
返回
0 -> 成功,<0 -> 失败
注意
非互动模式暂不支持该API,调用无任何效果 该方法只在startPush前调用有效,推流中不可以重新设置,stopPush后可以重新设置

在文件 AlivcLivePusher.java1658 行定义.

◆ setCustomAudioFilter()

void com.alivc.live.pusher.AlivcLivePusher.setCustomAudioFilter ( AlivcLivePushCustomAudioFilter  customAudioFilter)

设置用户自定义音频处理回调

参数
customAudioFilter回调接口

在文件 AlivcLivePusher.java592 行定义.

◆ setCustomDetect()

void com.alivc.live.pusher.AlivcLivePusher.setCustomDetect ( AlivcLivePushCustomDetect  customVideoDetect)

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

参数
customVideoDetect回调接口

在文件 AlivcLivePusher.java566 行定义.

◆ setCustomFilter()

void com.alivc.live.pusher.AlivcLivePusher.setCustomFilter ( AlivcLivePushCustomFilter  customVideoFilter)

设置用户自定义视频美颜回调

参数
customVideoFilter回调接口

在文件 AlivcLivePusher.java579 行定义.

◆ setExposure()

void com.alivc.live.pusher.AlivcLivePusher.setExposure ( int  exposure)

设置采集曝光

参数
exposure采集曝光

在文件 AlivcLivePusher.java1444 行定义.

◆ setExternalAudioStreamPlayoutVolume()

int com.alivc.live.pusher.AlivcLivePusher.setExternalAudioStreamPlayoutVolume ( int  streamId,
int  playoutVolume 
)

设置外部音频流播放音量

参数
streamId外部音频流Id
playoutVolume播放音量,取值范围[0, 100]
返回
0->成功, 非0->失败
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1288 行定义.

◆ setExternalAudioStreamPublishVolume()

int com.alivc.live.pusher.AlivcLivePusher.setExternalAudioStreamPublishVolume ( int  streamId,
int  publishVolume 
)

设置外部音频流推流音量

参数
streamId外部音频流Id
publishVolume推流音量,取值范围[0, 100]
返回
0->成功, 非0->失败
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1304 行定义.

◆ setExternalVideoSource()

void com.alivc.live.pusher.AlivcLivePusher.setExternalVideoSource ( boolean  enable,
boolean  useTexture,
AlivcLivePlayVideoStreamType  videoStreamType,
AlivcPreviewDisplayMode  previewDisplayMode 
)

启用外部视频输入源

参数
enable是否开启
useTexture是否输入纹理数据
videoStreamType媒体流类型
previewDisplayMode推流预览显示模式
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1225 行定义.

◆ setFlash()

void com.alivc.live.pusher.AlivcLivePusher.setFlash ( boolean  flash) throws IllegalStateException

是否打开闪光灯

参数
flashtrue:打开闪光灯 false:关闭闪光灯
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java427 行定义.

◆ setLiveMixTranscodingConfig()

int com.alivc.live.pusher.AlivcLivePusher.setLiveMixTranscodingConfig ( AlivcLiveTranscodingConfig  config)

设置云端的混流转码参数

参数
config云端混流转码参数
返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果
注解
该接口和 com.alivc.live.pusher.AlivcLivePushInfoListener#onSetLiveMixTranscodingConfig(AlivcLivePusher, boolean, String) 接口相对应
一个直播间中可能有不止一位主播,而且每个主播都有自己的画面和声音,但对于 CDN 观众来说,他们只需要一路直播流
所以您需要将多路音视频流混成一路标准的直播流,这就需要混流转码
在连麦场景下,需要将主播和连麦观众音视频流混成一路标准的直播流,供CDN观众观看
在PK场景下,需要将进行PK的多个主播的音视频流混成一路标准的直播流,供CDN观众观看
警告
若主播还在房间中但不再需要混流,请务必传入 null 进行取消,因为当发起混流后,云端混流模块就会开始工作,不及时取消混流可能会引起不必要的计费损失
参见
com.alivc.live.pusher.AlivcLiveTranscodingConfig
com.alivc.live.pusher.AlivcLivePushInfoListener::onSetLiveMixTranscodingConfig(com.alivc.live.pusher.AlivcLivePusher, boolean, String)

在文件 AlivcLivePusher.java1540 行定义.

◆ setLivePushBGMListener()

void com.alivc.live.pusher.AlivcLivePusher.setLivePushBGMListener ( AlivcLivePushBGMListener  pushBGMListener)

设置背景播放通知事件

参数
pushBGMListener通知监听器

在文件 AlivcLivePusher.java657 行定义.

◆ setLivePusherReference()

void com.alivc.live.pusher.AlivcLivePusher.setLivePusherReference ( AlivcLivePusher  livePusher)

设置直播推流实例

参数
livePusher推流实例

在文件 AlivcLivePusher.java109 行定义.

◆ setLivePushErrorListener()

void com.alivc.live.pusher.AlivcLivePusher.setLivePushErrorListener ( AlivcLivePushErrorListener  errorListener)

设置推流错误事件

参数
errorListener错误监听器

在文件 AlivcLivePusher.java618 行定义.

◆ setLivePushInfoListener()

void com.alivc.live.pusher.AlivcLivePusher.setLivePushInfoListener ( AlivcLivePushInfoListener  infoListener)

设置推流通知事件

参数
infoListener通知监听器

在文件 AlivcLivePusher.java631 行定义.

◆ setLivePushNetworkListener()

void com.alivc.live.pusher.AlivcLivePusher.setLivePushNetworkListener ( AlivcLivePushNetworkListener  networkListener)

设置网络通知事件

参数
networkListener通知监听器

在文件 AlivcLivePusher.java644 行定义.

◆ setLivePushRenderContextListener()

void com.alivc.live.pusher.AlivcLivePusher.setLivePushRenderContextListener ( AlivcLivePusherRenderContextListener  renderCtxListener)

设置render的context监听

参数
renderCtxListenerrender的context监听

在文件 AlivcLivePusher.java670 行定义.

◆ setMinVideoBitrate()

void com.alivc.live.pusher.AlivcLivePusher.setMinVideoBitrate ( int  minVideoBitrate) throws IllegalArgumentException, IllegalStateException

设置最小视频码率(Kbps)

参数
minVideoBitrate最小视频编码码率
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush

在文件 AlivcLivePusher.java483 行定义.

◆ setMixedWithMic()

int com.alivc.live.pusher.AlivcLivePusher.setMixedWithMic ( boolean  mixed)

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

参数
mixedtrue->混音;false->完全替换麦克风采集数据
返回
0->成功, 非0->失败
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1240 行定义.

◆ setMute()

void com.alivc.live.pusher.AlivcLivePusher.setMute ( boolean  mute) throws IllegalStateException

是否开启静音

参数
mutetrue->静音推流,false->恢复音频
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush
注解
调用此接口,音频采集不关闭,只控制是否静音
如果需要关闭音频采集,请参考以下接口:
参见
AlivcLivePusher::startAudioCapture(boolean)
AlivcLivePusher::stopAudioCapture()

在文件 AlivcLivePusher.java413 行定义.

◆ setPreviewMirror()

void com.alivc.live.pusher.AlivcLivePusher.setPreviewMirror ( boolean  mirror) throws IllegalStateException

预览镜像开关

参数
mirrortrue:打开预览镜像 false:关闭预览镜像
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java455 行定义.

◆ setPreviewMode()

void com.alivc.live.pusher.AlivcLivePusher.setPreviewMode ( AlivcPreviewDisplayMode  mode) throws IllegalStateException

设置预览显示模式

参数
mode预览显示模式
异常
IllegalStateException状态错误

在文件 AlivcLivePusher.java951 行定义.

◆ setPreviewOrientation()

void com.alivc.live.pusher.AlivcLivePusher.setPreviewOrientation ( AlivcPreviewOrientationEnum  orientation)

设置预览方向,默认竖屏

参数
orientation推流方向

在文件 AlivcLivePusher.java710 行定义.

◆ setPushMirror()

void com.alivc.live.pusher.AlivcLivePusher.setPushMirror ( boolean  mirror) throws IllegalStateException

推流端是否水平镜像

参数
mirrortrue:打开推流镜像 false:关闭推流镜像
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush

在文件 AlivcLivePusher.java441 行定义.

◆ setQualityMode()

void com.alivc.live.pusher.AlivcLivePusher.setQualityMode ( AlivcQualityModeEnum  mode) throws IllegalStateException

设置视频质量模式

参数
mode视频质量模式
异常
IllegalStateException状态错误

在文件 AlivcLivePusher.java937 行定义.

◆ setScreenOrientation()

void com.alivc.live.pusher.AlivcLivePusher.setScreenOrientation ( int  orientation)

录屏模式下,设置感应的屏幕旋转角度

参数
orientation屏幕旋转角度

在文件 AlivcLivePusher.java1106 行定义.

◆ setTargetVideoBitrate()

void com.alivc.live.pusher.AlivcLivePusher.setTargetVideoBitrate ( int  targetVideoBitrate) throws IllegalArgumentException, IllegalStateException

设置目标视频码率[100,5000](Kbps)

参数
targetVideoBitrate目标视频编码码率
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush

在文件 AlivcLivePusher.java469 行定义.

◆ setWatermarkVisible()

void com.alivc.live.pusher.AlivcLivePusher.setWatermarkVisible ( boolean  visible)

设置水印可见

参数
visible是否可见

在文件 AlivcLivePusher.java1067 行定义.

◆ setZoom()

void com.alivc.live.pusher.AlivcLivePusher.setZoom ( int  zoom) throws IllegalArgumentException, IllegalStateException

设置缩放

参数
zoom0~getMaxZoom()
异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java367 行定义.

◆ snapshot()

void com.alivc.live.pusher.AlivcLivePusher.snapshot ( int  count,
int  interval,
AlivcSnapshotListener  listener 
)

视频流截图

参数
count截取图片的个数,该参数仅在基础模式下生效
interval每张图片的间隔,该参数仅在基础模式下生效
listener截图回调

在文件 AlivcLivePusher.java1208 行定义.

◆ startAudioCapture()

int com.alivc.live.pusher.AlivcLivePusher.startAudioCapture ( boolean  keepAlive)

开启音频采集

参数
keepAlivetrue->停止推流后采集依然开启,false->停止推流后采集关闭
返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果
注解
调用此接口,音频采集会被开启
如果只需要静音,不关闭音频采集,请参考以下接口:
参见
AlivcLivePusher::setMute(boolean)

在文件 AlivcLivePusher.java1596 行定义.

◆ startBGMAsync() [1/2]

int com.alivc.live.pusher.AlivcLivePusher.startBGMAsync ( String  path) throws IllegalStateException

播放背景音乐

参数
path背景音乐路径
返回
0->成功, 非0->失败
异常
IllegalStateException状态错误

在文件 AlivcLivePusher.java757 行定义.

◆ startBGMAsync() [2/2]

int com.alivc.live.pusher.AlivcLivePusher.startBGMAsync ( String  path,
AlivcLiveBGMConfig  bgmConfig 
)

播放背景音乐

参数
path背景音乐路径
bgmConfig设置BGM背景音乐的配置
返回
0->成功, 非0->失败
注意
非基础模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java773 行定义.

◆ startCamera()

int com.alivc.live.pusher.AlivcLivePusher.startCamera ( SurfaceView  surfaceView) throws IllegalStateException

录屏模式下,开启摄像头预览 如果不需要预览,则surfaceView填为null

参数
surfaceViewsurfaceView
返回
0->成功, 非0->失败

在文件 AlivcLivePusher.java1082 行定义.

◆ startCameraMix()

int com.alivc.live.pusher.AlivcLivePusher.startCameraMix ( float  x,
float  y,
float  w,
float  h 
)

录屏模式下,开启摄像头混流

参数
x混流显示x初始位置(0~1.0f)
y混流显示y初始位置(0~1.0f)
w混流显示宽度(0~1.0f)
h混流显示高度(0~1.0f)
返回
0->成功, 非0->失败

在文件 AlivcLivePusher.java1123 行定义.

◆ startIntelligentDenoise()

int com.alivc.live.pusher.AlivcLivePusher.startIntelligentDenoise ( )

开启音频智能降噪

返回
0->成功, 非0->失败
注解
1、使用智能降噪,请关闭普通降噪;两者功能互斥使用
2、智能降噪功能以插件形式提供,调用该接口前,请确保已集成了libpluginAliDenoise.so;插件获取方式请参考官网文档;
3、此接口可以通话过程中控制打开智能降噪功能,通话过程中可以支持开启和关闭智能降噪
4、默认关闭,开启后可能导致功耗增加,智能降噪适合于会议,教育等语音通讯为主的场景,不适合有背景音乐的场景
注意事项
注解
如遇libMNN相关的so冲突,请检查当前工程中是否使用到了视频云的其它产品,如美颜SDK/Animoji SDK
美颜SDK/Animoji SDK中,包含libMNN相关的so,因此外部无需再导入一份,只保留libpluginAliDenoise.so,
全局MNN相关的库,统一留一份即可;
具体请查看官网文档或API文档,或者您可以咨询技术同学协助解决问题;
参见
音频智能降噪

在文件 AlivcLivePusher.java909 行定义.

◆ startLastMileDetect()

int com.alivc.live.pusher.AlivcLivePusher.startLastMileDetect ( AlivcLiveNetworkQualityProbeConfig  networkQualityProbeConfig)

开始网络质量探测

参数
networkQualityProbeConfig网络探测配置
返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果
注解
网络质量探测需要在未推流,即:startPush 之前调用,开始推流后不能调用
在3s左右,粗略的结果会在 AlivcLivePushNetworkListener#onLastMileDetectResultWithQuality(AlivcLivePusher, AlivcLiveNetworkQuality) 中回调
在30s左右,更多的结果会在 AlivcLivePushNetworkListener#onLastMileDetectResultWithBandWidth(AlivcLivePusher, int, AlivcLiveNetworkQualityProbeResult) 中回调
参见
AlivcLivePushNetworkListener::onLastMileDetectResultWithQuality(AlivcLivePusher, AlivcLiveNetworkQuality)
AlivcLivePushNetworkListener::onLastMileDetectResultWithBandWidth(AlivcLivePusher, int, AlivcLiveNetworkQualityProbeResult)

在文件 AlivcLivePusher.java1780 行定义.

◆ startLocalRecord()

boolean com.alivc.live.pusher.AlivcLivePusher.startLocalRecord ( AlivcLiveLocalRecordConfig  localRecordConfig)

开启本地音视频流录制

参数
localRecordConfig本地录制配置
返回
true->调用成功,false->调用失败
注意
非互动模式暂不支持该API,调用无任何效果
注解
开启后把直播中的音视频内容录制到本地的一个文件。调用接口后,通过 AlivcLivePushInfoListener#onLocalRecordEvent(AlivcLiveRecordMediaEvent, String) 回调通知录制状态
参见
AlivcLivePushInfoListener::onLocalRecordEvent(AlivcLiveRecordMediaEvent, String)

在文件 AlivcLivePusher.java1151 行定义.

◆ startPreview() [1/2]

void com.alivc.live.pusher.AlivcLivePusher.startPreview ( Context  context,
FrameLayout  frameLayout,
boolean  isAnchor 
) throws IllegalArgumentException, IllegalStateException

开始预览(仅用于互动模式)

参数
contextandroid context
frameLayoutFrameLayout容器;渲染视图由SDK内部创建,并addView到容器中
isAnchor是否主播;如果是主播,该视图需要放在最下层级进行全屏展示,避免遮挡其它渲染视图
异常
IllegalArgumentException参数错误
IllegalStateException状态错误
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java159 行定义.

◆ startPreview() [2/2]

void com.alivc.live.pusher.AlivcLivePusher.startPreview ( SurfaceView  surfaceView) throws IllegalArgumentException, IllegalStateException

开始预览(仅用于基础模式)

参数
surfaceViewsurfaceView
异常
IllegalArgumentException如果surfaceView为空,或者surfaceView的surface未创建/已销毁
IllegalStateException如果状态不对,例如还未初始化
注意
非基础模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java125 行定义.

◆ startPreviewAsync()

void com.alivc.live.pusher.AlivcLivePusher.startPreviewAsync ( SurfaceView  surfaceView) throws IllegalArgumentException, IllegalStateException

异步开始预览(仅用于基础模式)

参数
surfaceViewsurfaceView
异常
IllegalArgumentException如果surfaceView为空,或者surfaceView的surface未创建/已销毁
IllegalStateException如果状态不对,例如还未初始化
注意
非基础模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java141 行定义.

◆ startPush()

void com.alivc.live.pusher.AlivcLivePusher.startPush ( String  url) throws IllegalArgumentException, IllegalStateException

开始推流

参数
url推流Url
异常
IllegalArgumentException如果url为空,或者不是有效的url格式
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java203 行定义.

◆ startPushAsync()

void com.alivc.live.pusher.AlivcLivePusher.startPushAsync ( String  url) throws IllegalArgumentException, IllegalStateException

开始异步推流

参数
url推流Url
异常
IllegalArgumentException如果url为空,或者不是有效的url格式
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java218 行定义.

◆ startScreenShare()

int com.alivc.live.pusher.AlivcLivePusher.startScreenShare ( )

启动屏幕分享

注意
非互动模式暂不支持该API,调用无任何效果
返回
0->成功, 非0->失败

在文件 AlivcLivePusher.java1179 行定义.

◆ stopAudioCapture()

int com.alivc.live.pusher.AlivcLivePusher.stopAudioCapture ( )

关闭音频采集

返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果
注解
调用此接口,音频采集会被关闭
如果只需要静音,不关闭音频采集,请参考以下接口:
参见
AlivcLivePusher::setMute(boolean)

在文件 AlivcLivePusher.java1613 行定义.

◆ stopBGMAsync()

void com.alivc.live.pusher.AlivcLivePusher.stopBGMAsync ( ) throws IllegalStateException

停止播放背景音乐

异常
IllegalStateException状态错误

在文件 AlivcLivePusher.java786 行定义.

◆ stopCamera()

void com.alivc.live.pusher.AlivcLivePusher.stopCamera ( )

录屏模式下,关闭摄像头预览

在文件 AlivcLivePusher.java1093 行定义.

◆ stopCameraMix()

void com.alivc.live.pusher.AlivcLivePusher.stopCameraMix ( )

录屏模式下,停止摄像头混流

在文件 AlivcLivePusher.java1134 行定义.

◆ stopIntelligentDenoise()

int com.alivc.live.pusher.AlivcLivePusher.stopIntelligentDenoise ( )

关闭音频智能降噪

返回
0->成功, 非0->失败
注解
此接口可以通话过程中控制关闭智能降噪功能

在文件 AlivcLivePusher.java923 行定义.

◆ stopLastMileDetect()

int com.alivc.live.pusher.AlivcLivePusher.stopLastMileDetect ( )

停止网络质量探测

返回
0->成功,非0->失败
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java1794 行定义.

◆ stopLocalRecord()

void com.alivc.live.pusher.AlivcLivePusher.stopLocalRecord ( )

停止本地音视频流录制

注意
非互动模式暂不支持该API,调用无任何效果
注解
如果录制任务在结束推流前尚未通过本接口停止,则结束推流后录制任务会自动被停止。

在文件 AlivcLivePusher.java1165 行定义.

◆ stopPreview()

void com.alivc.live.pusher.AlivcLivePusher.stopPreview ( ) throws IllegalStateException

结束预览

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java188 行定义.

◆ stopPush()

void com.alivc.live.pusher.AlivcLivePusher.stopPush ( ) throws IllegalStateException

结束推流

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPush

在文件 AlivcLivePusher.java271 行定义.

◆ stopScreenShare()

int com.alivc.live.pusher.AlivcLivePusher.stopScreenShare ( )

停止屏幕分享

注意
非互动模式暂不支持该API,调用无任何效果
返回
0->成功, 非0->失败

在文件 AlivcLivePusher.java1193 行定义.

◆ switchCamera()

void com.alivc.live.pusher.AlivcLivePusher.switchCamera ( ) throws IllegalStateException

切换摄像头

异常
IllegalStateException如果状态不对,例如还未初始化/未startPreview

在文件 AlivcLivePusher.java323 行定义.

◆ updatePreview()

void com.alivc.live.pusher.AlivcLivePusher.updatePreview ( Context  context,
FrameLayout  frameLayout,
boolean  isAnchor 
)

更新预览视图(仅用于互动模式)

参数
contextandroid context
frameLayoutFrameLayout容器;渲染视图由SDK内部创建,并addView到容器中
isAnchor是否主播;如果是主播,该视图需要放在最下层级进行全屏展示,避免遮挡其它渲染视图
注意
非互动模式暂不支持该API,调用无任何效果

在文件 AlivcLivePusher.java175 行定义.