「主要API」推流接口类 更多...
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」推流接口类
在文件 AlivcLivePusher.java 第 43 行定义.
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) |
在文件 AlivcLivePusher.java 第 1418 行定义.
int com.alivc.live.pusher.AlivcLivePusher.addExternalAudioStream | ( | AlivcLivePushExternalAudioStreamConfig | externalAudioStreamConfig | ) |
新增外部音频流
externalAudioStreamConfig | 外部音频流配置 |
在文件 AlivcLivePusher.java 第 1255 行定义.
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 |
在文件 AlivcLivePusher.java 第 1054 行定义.
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 |
在文件 AlivcLivePusher.java 第 1035 行定义.
void com.alivc.live.pusher.AlivcLivePusher.changeResolution | ( | AlivcResolutionEnum | resolution | ) |
void com.alivc.live.pusher.AlivcLivePusher.destroy | ( | ) | throws IllegalStateException |
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(默认值):关闭。 |
在文件 AlivcLivePusher.java 第 1760 行定义.
int com.alivc.live.pusher.AlivcLivePusher.enableLocalCamera | ( | boolean | enable | ) |
禁用或启用本地视频采集
enable | true->启用本地视频采集,false->关闭本地视频采集 |
在文件 AlivcLivePusher.java 第 1578 行定义.
int com.alivc.live.pusher.AlivcLivePusher.enableSpeakerphone | ( | boolean | enable | ) |
设置音频输出为听筒还是扬声器
enable | true:扬声器模式(默认扬声器);false:听筒模式 |
在文件 AlivcLivePusher.java 第 1628 行定义.
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.java 第 353 行定义.
int com.alivc.live.pusher.AlivcLivePusher.getCurrentExposure | ( | ) |
AlivcLivePushStats com.alivc.live.pusher.AlivcLivePusher.getCurrentStatus | ( | ) |
int com.alivc.live.pusher.AlivcLivePusher.getCurrentZoom | ( | ) | throws IllegalStateException |
获取当前缩放值
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview |
在文件 AlivcLivePusher.java 第 395 行定义.
AlivcLivePushError com.alivc.live.pusher.AlivcLivePusher.getLastError | ( | ) |
AlivcLivePushStatsInfo com.alivc.live.pusher.AlivcLivePusher.getLivePushStatsInfo | ( | ) | throws IllegalStateException |
String com.alivc.live.pusher.AlivcLivePusher.getLiveTraceId | ( | ) |
int com.alivc.live.pusher.AlivcLivePusher.getMaxZoom | ( | ) | throws IllegalStateException |
获取摄像头支持的最大缩放值
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview |
在文件 AlivcLivePusher.java 第 381 行定义.
String com.alivc.live.pusher.AlivcLivePusher.getPushUrl | ( | ) |
int com.alivc.live.pusher.AlivcLivePusher.getSupportedMaxExposure | ( | ) |
int com.alivc.live.pusher.AlivcLivePusher.getSupportedMinExposure | ( | ) |
AlivcEncodeType com.alivc.live.pusher.AlivcLivePusher.getVideoCodecType | ( | ) |
void com.alivc.live.pusher.AlivcLivePusher.init | ( | Context | context, |
AlivcLivePushConfig | config | ||
) | throws IllegalArgumentException, IllegalStateException |
初始化推流引擎
context | android context |
config | 推流配置 |
IllegalArgumentException | 如果配置为空,或者配置值无效(例如码率的值超过范围) |
IllegalStateException | 如果状态不对,例如已经初始化,但是还没有销毁 |
在文件 AlivcLivePusher.java 第 58 行定义.
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) |
在文件 AlivcLivePusher.java 第 1400 行定义.
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) |
在文件 AlivcLivePusher.java 第 1381 行定义.
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 | 视频图像旋转角度 |
在文件 AlivcLivePusher.java 第 1361 行定义.
void com.alivc.live.pusher.AlivcLivePusher.inputStreamVideoPtr | ( | long | dataPtr, |
int | width, | ||
int | height, | ||
int | stride, | ||
int | size, | ||
long | pts, | ||
int | rotation | ||
) |
输入自定义视频流 (deprecated)
dataPtr | native内存指针 |
width | 视频图像宽度 |
height | 视频图像高度 |
stride | 视频图像高度 |
size | 视频图像size |
pts | 视频图像pts(us) |
rotation | 视频图像旋转角度 |
在文件 AlivcLivePusher.java 第 1340 行定义.
boolean com.alivc.live.pusher.AlivcLivePusher.isCameraSupportAutoFocus | ( | ) |
boolean com.alivc.live.pusher.AlivcLivePusher.isCameraSupportFlash | ( | ) |
boolean com.alivc.live.pusher.AlivcLivePusher.isNetworkPushing | ( | ) | throws IllegalStateException |
boolean com.alivc.live.pusher.AlivcLivePusher.isPushing | ( | ) | throws IllegalStateException |
是否正在推流
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush |
在文件 AlivcLivePusher.java 第 539 行定义.
boolean com.alivc.live.pusher.AlivcLivePusher.isSpeakerphoneOn | ( | ) |
获取当前音频输出为听筒还是扬声器
在文件 AlivcLivePusher.java 第 1642 行定义.
int com.alivc.live.pusher.AlivcLivePusher.muteLocalCamera | ( | boolean | mute | ) |
关闭/打开摄像头
mute | true->不发送视频数据,false->恢复正常 |
在文件 AlivcLivePusher.java 第 1560 行定义.
void com.alivc.live.pusher.AlivcLivePusher.pause | ( | ) | throws IllegalStateException |
暂停推流
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush/已经pause |
在文件 AlivcLivePusher.java 第 284 行定义.
void com.alivc.live.pusher.AlivcLivePusher.pauseBGM | ( | ) | throws IllegalStateException |
void com.alivc.live.pusher.AlivcLivePusher.pauseScreenCapture | ( | ) | throws IllegalStateException |
暂停录屏推流(隐私开)
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush/已经pause |
在文件 AlivcLivePusher.java 第 964 行定义.
int com.alivc.live.pusher.AlivcLivePusher.pushExternalAudioStream | ( | int | streamId, |
AlivcLivePusherAudioDataSample | audioDataSample | ||
) |
输入外部音频流数据
streamId | 外部音频流Id |
audioDataSample | 外部音频裸数据 |
在文件 AlivcLivePusher.java 第 1272 行定义.
void com.alivc.live.pusher.AlivcLivePusher.reconnectPushAsync | ( | String | url | ) | throws IllegalStateException |
重新连接进行推流
url | 推流URL |
IllegalStateException | 例如还未初始化/未startPreview/未startPush/已经stopPush |
在文件 AlivcLivePusher.java 第 258 行定义.
void com.alivc.live.pusher.AlivcLivePusher.refreshPushURLToken | ( | String | url | ) |
刷新Token鉴权信息,传入一个新的推流URL,包含未过期的新token信息,房间ID/用户ID/sdkAppId需要和之前保持一样
url | 推流Url |
AlivcLivePushNetworkListener#onPushURLAuthenticationOverdue(AlivcLivePusher)
回调时,外部应当更新鉴权信息,否则会导致断流 在文件 AlivcLivePusher.java 第 499 行定义.
void com.alivc.live.pusher.AlivcLivePusher.removeDynamicsAddons | ( | int | id | ) |
int com.alivc.live.pusher.AlivcLivePusher.removeExternalAudioStream | ( | int | streamId | ) |
删除外部音频流
streamId | 外部音频流Id |
在文件 AlivcLivePusher.java 第 1319 行定义.
void com.alivc.live.pusher.AlivcLivePusher.restartPush | ( | ) | throws IllegalStateException |
重新开始推流
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPush |
在文件 AlivcLivePusher.java 第 231 行定义.
void com.alivc.live.pusher.AlivcLivePusher.restartPushAsync | ( | ) | throws IllegalStateException |
重新开始推流
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPush |
在文件 AlivcLivePusher.java 第 244 行定义.
void com.alivc.live.pusher.AlivcLivePusher.resume | ( | ) | throws IllegalStateException |
恢复推流
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resume |
在文件 AlivcLivePusher.java 第 297 行定义.
void com.alivc.live.pusher.AlivcLivePusher.resumeAsync | ( | ) | throws IllegalStateException |
异步恢复推流
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resume |
在文件 AlivcLivePusher.java 第 310 行定义.
void com.alivc.live.pusher.AlivcLivePusher.resumeBGM | ( | ) | throws IllegalStateException |
void com.alivc.live.pusher.AlivcLivePusher.resumeScreenCapture | ( | ) | throws IllegalStateException |
恢复录屏推流(隐私关)
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush/未pause/已resume |
在文件 AlivcLivePusher.java 第 977 行定义.
int com.alivc.live.pusher.AlivcLivePusher.sendDataChannelMessage | ( | String | message | ) |
推流端通过数据通道发送自定义消息
message | 自定义消息 |
com.alivc.live.pusher.AlivcLivePushConfig#setEnableDataChannelMessage(boolean)
接口开启功能 com.alivc.live.player.AlivcLivePlayInfoListener#onReceiveDataChannelMessage(byte[])
回调接收消息 在文件 AlivcLivePusher.java 第 1517 行定义.
void com.alivc.live.pusher.AlivcLivePusher.sendMessage | ( | String | info, |
int | repeat, | ||
int | delay, | ||
boolean | isKeyFrame | ||
) |
推流端发送自定义消息
info | 需要插入流的SEI消息体,建议是json格式 |
repeat | 发送的帧数 |
delay | 延时多少毫秒发送 |
isKeyFrame | 是否只发送关键帧 |
在文件 AlivcLivePusher.java 第 1499 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setAudioDenoise | ( | boolean | enable | ) |
设置音频降噪
enable | true:开启 false:关闭 |
在文件 AlivcLivePusher.java 第 886 行定义.
int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectBeautifyMode | ( | AlivcLiveAudioEffectBeautifyMode | audioEffectBeautifyMode | ) |
设置美声音效模式
audioEffectBeautifyMode | 美声模式 |
在文件 AlivcLivePusher.java 第 1705 行定义.
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 |
在文件 AlivcLivePusher.java 第 1740 行定义.
int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectPitchValue | ( | double | value | ) |
设置变调参数
value | 变调参数 |
在文件 AlivcLivePusher.java 第 1689 行定义.
int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectReverbMode | ( | AlivcLivePushAudioEffectReverbMode | mode | ) |
int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectReverbParamType | ( | AlivcLiveAudioEffectReverbParamType | audioEffectReverbParamType, |
float | value | ||
) |
设置混响音效类型
audioEffectReverbParamType | 混响音效类型 |
AlivcLivePusher#setAudioEffectReverbMode
后调用 在文件 AlivcLivePusher.java 第 1722 行定义.
int com.alivc.live.pusher.AlivcLivePusher.setAudioEffectVoiceChangeMode | ( | AlivcLivePushAudioEffectVoiceChangeMode | mode | ) |
int com.alivc.live.pusher.AlivcLivePusher.setAudioProfile | ( | AlivcLiveAudioProfileQualityMode | audioProfileQualityMode | ) |
设置音频profile
audioProfileQualityMode | 音频profile |
在文件 AlivcLivePusher.java 第 1673 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setAutoFocus | ( | boolean | autoFocus | ) | throws IllegalStateException |
设置自动对焦
autoFocus | 自动聚焦 |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview |
在文件 AlivcLivePusher.java 第 337 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setBGMEarsBack | ( | boolean | isOpen | ) | throws IllegalStateException |
void com.alivc.live.pusher.AlivcLivePusher.setBGMLoop | ( | boolean | isLoop | ) | throws IllegalStateException |
void com.alivc.live.pusher.AlivcLivePusher.setBGMVolume | ( | int | volume | ) | throws IllegalStateException, IllegalArgumentException |
设置背景音乐音量
volume | 背景音乐音量 范围:[0 ~ 100] 默认:50 |
IllegalStateException | 状态错误 |
IllegalArgumentException | 参数错误 |
在文件 AlivcLivePusher.java 第 855 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setCaptureVolume | ( | int | volume | ) | throws IllegalStateException, IllegalArgumentException |
设置人声音量
volume | 人声音量 范围:[0 ~ 100] 默认:50 |
IllegalStateException | 状态错误 |
IllegalArgumentException | 参数错误 |
在文件 AlivcLivePusher.java 第 870 行定义.
int com.alivc.live.pusher.AlivcLivePusher.setChannelProfile | ( | AlivcLiveChannelProfile | channelProfile | ) |
设置频道模式
channelProfile | 频道模式类型,默认INTERACTIVE_LIVE |
startPush
前调用有效,推流中不可以重新设置,stopPush
后可以重新设置 在文件 AlivcLivePusher.java 第 1658 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setCustomAudioFilter | ( | AlivcLivePushCustomAudioFilter | customAudioFilter | ) |
void com.alivc.live.pusher.AlivcLivePusher.setCustomDetect | ( | AlivcLivePushCustomDetect | customVideoDetect | ) |
void com.alivc.live.pusher.AlivcLivePusher.setCustomFilter | ( | AlivcLivePushCustomFilter | customVideoFilter | ) |
void com.alivc.live.pusher.AlivcLivePusher.setExposure | ( | int | exposure | ) |
int com.alivc.live.pusher.AlivcLivePusher.setExternalAudioStreamPlayoutVolume | ( | int | streamId, |
int | playoutVolume | ||
) |
设置外部音频流播放音量
streamId | 外部音频流Id |
playoutVolume | 播放音量,取值范围[0, 100] |
在文件 AlivcLivePusher.java 第 1288 行定义.
int com.alivc.live.pusher.AlivcLivePusher.setExternalAudioStreamPublishVolume | ( | int | streamId, |
int | publishVolume | ||
) |
设置外部音频流推流音量
streamId | 外部音频流Id |
publishVolume | 推流音量,取值范围[0, 100] |
在文件 AlivcLivePusher.java 第 1304 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setExternalVideoSource | ( | boolean | enable, |
boolean | useTexture, | ||
AlivcLivePlayVideoStreamType | videoStreamType, | ||
AlivcPreviewDisplayMode | previewDisplayMode | ||
) |
启用外部视频输入源
enable | 是否开启 |
useTexture | 是否输入纹理数据 |
videoStreamType | 媒体流类型 |
previewDisplayMode | 推流预览显示模式 |
在文件 AlivcLivePusher.java 第 1225 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setFlash | ( | boolean | flash | ) | throws IllegalStateException |
是否打开闪光灯
flash | true:打开闪光灯 false:关闭闪光灯 |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview |
在文件 AlivcLivePusher.java 第 427 行定义.
int com.alivc.live.pusher.AlivcLivePusher.setLiveMixTranscodingConfig | ( | AlivcLiveTranscodingConfig | config | ) |
设置云端的混流转码参数
config | 云端混流转码参数 |
com.alivc.live.pusher.AlivcLivePushInfoListener#onSetLiveMixTranscodingConfig(AlivcLivePusher, boolean, String)
接口相对应 在文件 AlivcLivePusher.java 第 1540 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setLivePushBGMListener | ( | AlivcLivePushBGMListener | pushBGMListener | ) |
void com.alivc.live.pusher.AlivcLivePusher.setLivePusherReference | ( | AlivcLivePusher | livePusher | ) |
void com.alivc.live.pusher.AlivcLivePusher.setLivePushErrorListener | ( | AlivcLivePushErrorListener | errorListener | ) |
void com.alivc.live.pusher.AlivcLivePusher.setLivePushInfoListener | ( | AlivcLivePushInfoListener | infoListener | ) |
void com.alivc.live.pusher.AlivcLivePusher.setLivePushNetworkListener | ( | AlivcLivePushNetworkListener | networkListener | ) |
void com.alivc.live.pusher.AlivcLivePusher.setLivePushRenderContextListener | ( | AlivcLivePusherRenderContextListener | renderCtxListener | ) |
void com.alivc.live.pusher.AlivcLivePusher.setMinVideoBitrate | ( | int | minVideoBitrate | ) | throws IllegalArgumentException, IllegalStateException |
设置最小视频码率(Kbps)
minVideoBitrate | 最小视频编码码率 |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush |
在文件 AlivcLivePusher.java 第 483 行定义.
int com.alivc.live.pusher.AlivcLivePusher.setMixedWithMic | ( | boolean | mixed | ) |
设置是否与麦克风采集音频混合
mixed | true->混音;false->完全替换麦克风采集数据 |
在文件 AlivcLivePusher.java 第 1240 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setMute | ( | boolean | mute | ) | throws IllegalStateException |
是否开启静音
mute | true->静音推流,false->恢复音频 |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush |
在文件 AlivcLivePusher.java 第 413 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setPreviewMirror | ( | boolean | mirror | ) | throws IllegalStateException |
预览镜像开关
mirror | true:打开预览镜像 false:关闭预览镜像 |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview |
在文件 AlivcLivePusher.java 第 455 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setPreviewMode | ( | AlivcPreviewDisplayMode | mode | ) | throws IllegalStateException |
void com.alivc.live.pusher.AlivcLivePusher.setPreviewOrientation | ( | AlivcPreviewOrientationEnum | orientation | ) |
void com.alivc.live.pusher.AlivcLivePusher.setPushMirror | ( | boolean | mirror | ) | throws IllegalStateException |
推流端是否水平镜像
mirror | true:打开推流镜像 false:关闭推流镜像 |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush |
在文件 AlivcLivePusher.java 第 441 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setQualityMode | ( | AlivcQualityModeEnum | mode | ) | throws IllegalStateException |
void com.alivc.live.pusher.AlivcLivePusher.setScreenOrientation | ( | int | orientation | ) |
void com.alivc.live.pusher.AlivcLivePusher.setTargetVideoBitrate | ( | int | targetVideoBitrate | ) | throws IllegalArgumentException, IllegalStateException |
设置目标视频码率[100,5000](Kbps)
targetVideoBitrate | 目标视频编码码率 |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush |
在文件 AlivcLivePusher.java 第 469 行定义.
void com.alivc.live.pusher.AlivcLivePusher.setWatermarkVisible | ( | boolean | visible | ) |
void com.alivc.live.pusher.AlivcLivePusher.setZoom | ( | int | zoom | ) | throws IllegalArgumentException, IllegalStateException |
设置缩放
zoom | 0~getMaxZoom() |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview |
在文件 AlivcLivePusher.java 第 367 行定义.
void com.alivc.live.pusher.AlivcLivePusher.snapshot | ( | int | count, |
int | interval, | ||
AlivcSnapshotListener | listener | ||
) |
视频流截图
count | 截取图片的个数,该参数仅在基础模式下生效 |
interval | 每张图片的间隔,该参数仅在基础模式下生效 |
listener | 截图回调 |
在文件 AlivcLivePusher.java 第 1208 行定义.
int com.alivc.live.pusher.AlivcLivePusher.startAudioCapture | ( | boolean | keepAlive | ) |
开启音频采集
keepAlive | true->停止推流后采集依然开启,false->停止推流后采集关闭 |
在文件 AlivcLivePusher.java 第 1596 行定义.
int com.alivc.live.pusher.AlivcLivePusher.startBGMAsync | ( | String | path | ) | throws IllegalStateException |
播放背景音乐
path | 背景音乐路径 |
IllegalStateException | 状态错误 |
在文件 AlivcLivePusher.java 第 757 行定义.
int com.alivc.live.pusher.AlivcLivePusher.startBGMAsync | ( | String | path, |
AlivcLiveBGMConfig | bgmConfig | ||
) |
播放背景音乐
path | 背景音乐路径 |
bgmConfig | 设置BGM背景音乐的配置 |
在文件 AlivcLivePusher.java 第 773 行定义.
int com.alivc.live.pusher.AlivcLivePusher.startCamera | ( | SurfaceView | surfaceView | ) | throws IllegalStateException |
录屏模式下,开启摄像头预览 如果不需要预览,则surfaceView填为null
surfaceView | surfaceView |
在文件 AlivcLivePusher.java 第 1082 行定义.
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) |
在文件 AlivcLivePusher.java 第 1123 行定义.
int com.alivc.live.pusher.AlivcLivePusher.startIntelligentDenoise | ( | ) |
开启音频智能降噪
在文件 AlivcLivePusher.java 第 909 行定义.
int com.alivc.live.pusher.AlivcLivePusher.startLastMileDetect | ( | AlivcLiveNetworkQualityProbeConfig | networkQualityProbeConfig | ) |
开始网络质量探测
networkQualityProbeConfig | 网络探测配置 |
AlivcLivePushNetworkListener#onLastMileDetectResultWithQuality(AlivcLivePusher, AlivcLiveNetworkQuality)
中回调 AlivcLivePushNetworkListener#onLastMileDetectResultWithBandWidth(AlivcLivePusher, int, AlivcLiveNetworkQualityProbeResult)
中回调 在文件 AlivcLivePusher.java 第 1780 行定义.
boolean com.alivc.live.pusher.AlivcLivePusher.startLocalRecord | ( | AlivcLiveLocalRecordConfig | localRecordConfig | ) |
开启本地音视频流录制
localRecordConfig | 本地录制配置 |
AlivcLivePushInfoListener#onLocalRecordEvent(AlivcLiveRecordMediaEvent, String)
回调通知录制状态 在文件 AlivcLivePusher.java 第 1151 行定义.
void com.alivc.live.pusher.AlivcLivePusher.startPreview | ( | Context | context, |
FrameLayout | frameLayout, | ||
boolean | isAnchor | ||
) | throws IllegalArgumentException, IllegalStateException |
开始预览(仅用于互动模式)
context | android context |
frameLayout | FrameLayout容器;渲染视图由SDK内部创建,并addView到容器中 |
isAnchor | 是否主播;如果是主播,该视图需要放在最下层级进行全屏展示,避免遮挡其它渲染视图 |
IllegalArgumentException | 参数错误 |
IllegalStateException | 状态错误 |
在文件 AlivcLivePusher.java 第 159 行定义.
void com.alivc.live.pusher.AlivcLivePusher.startPreview | ( | SurfaceView | surfaceView | ) | throws IllegalArgumentException, IllegalStateException |
开始预览(仅用于基础模式)
surfaceView | surfaceView |
IllegalArgumentException | 如果surfaceView为空,或者surfaceView的surface未创建/已销毁 |
IllegalStateException | 如果状态不对,例如还未初始化 |
在文件 AlivcLivePusher.java 第 125 行定义.
void com.alivc.live.pusher.AlivcLivePusher.startPreviewAsync | ( | SurfaceView | surfaceView | ) | throws IllegalArgumentException, IllegalStateException |
异步开始预览(仅用于基础模式)
surfaceView | surfaceView |
IllegalArgumentException | 如果surfaceView为空,或者surfaceView的surface未创建/已销毁 |
IllegalStateException | 如果状态不对,例如还未初始化 |
在文件 AlivcLivePusher.java 第 141 行定义.
void com.alivc.live.pusher.AlivcLivePusher.startPush | ( | String | url | ) | throws IllegalArgumentException, IllegalStateException |
开始推流
url | 推流Url |
IllegalArgumentException | 如果url为空,或者不是有效的url格式 |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview |
在文件 AlivcLivePusher.java 第 203 行定义.
void com.alivc.live.pusher.AlivcLivePusher.startPushAsync | ( | String | url | ) | throws IllegalArgumentException, IllegalStateException |
开始异步推流
url | 推流Url |
IllegalArgumentException | 如果url为空,或者不是有效的url格式 |
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview |
在文件 AlivcLivePusher.java 第 218 行定义.
int com.alivc.live.pusher.AlivcLivePusher.startScreenShare | ( | ) |
int com.alivc.live.pusher.AlivcLivePusher.stopAudioCapture | ( | ) |
关闭音频采集
在文件 AlivcLivePusher.java 第 1613 行定义.
void com.alivc.live.pusher.AlivcLivePusher.stopBGMAsync | ( | ) | throws IllegalStateException |
void com.alivc.live.pusher.AlivcLivePusher.stopCamera | ( | ) |
录屏模式下,关闭摄像头预览
在文件 AlivcLivePusher.java 第 1093 行定义.
void com.alivc.live.pusher.AlivcLivePusher.stopCameraMix | ( | ) |
录屏模式下,停止摄像头混流
在文件 AlivcLivePusher.java 第 1134 行定义.
int com.alivc.live.pusher.AlivcLivePusher.stopIntelligentDenoise | ( | ) |
int com.alivc.live.pusher.AlivcLivePusher.stopLastMileDetect | ( | ) |
void com.alivc.live.pusher.AlivcLivePusher.stopLocalRecord | ( | ) |
停止本地音视频流录制
在文件 AlivcLivePusher.java 第 1165 行定义.
void com.alivc.live.pusher.AlivcLivePusher.stopPreview | ( | ) | throws IllegalStateException |
void com.alivc.live.pusher.AlivcLivePusher.stopPush | ( | ) | throws IllegalStateException |
结束推流
IllegalStateException | 如果状态不对,例如还未初始化/未startPreview/未startPush/已经stopPush |
在文件 AlivcLivePusher.java 第 271 行定义.
int com.alivc.live.pusher.AlivcLivePusher.stopScreenShare | ( | ) |
void com.alivc.live.pusher.AlivcLivePusher.switchCamera | ( | ) | throws IllegalStateException |
void com.alivc.live.pusher.AlivcLivePusher.updatePreview | ( | Context | context, |
FrameLayout | frameLayout, | ||
boolean | isAnchor | ||
) |
更新预览视图(仅用于互动模式)
context | android context |
frameLayout | FrameLayout容器;渲染视图由SDK内部创建,并addView到容器中 |
isAnchor | 是否主播;如果是主播,该视图需要放在最下层级进行全屏展示,避免遮挡其它渲染视图 |
在文件 AlivcLivePusher.java 第 175 行定义.