1 package com.alivc.live.pusher;
3 import android.content.Context;
4 import android.view.SurfaceView;
5 import android.widget.FrameLayout;
28 private ILivePusher mImpl = null;
30 private static final String BASIC_PUSHER_IMPL_CLASS =
"com.alivc.live.pusher.AlivcLivePusherBasicImpl";
31 private static final String INTERACTIVE_PUSHER_IMPL_CLASS =
"com.alivc.live.pusher.rtc.AlivcRTCLivePusherImpl";
46 throw new IllegalArgumentException(
"Invalid parameter, config is null.");
49 reflectInitPusher(config.getLivePushMode());
55 mImpl.init(context, config);
59 Object playerInstance = null;
62 playerInstance = ReflectUtil.reflectInit(INTERACTIVE_PUSHER_IMPL_CLASS, null, null);
64 playerInstance = ReflectUtil.reflectInit(BASIC_PUSHER_IMPL_CLASS, null, null);
67 if (playerInstance == null) {
68 throw new RuntimeException(
"init live pusher error! now not support mode: " + mode);
71 mImpl = (ILivePusher) playerInstance;
80 public void destroy() throws IllegalStateException {
97 mImpl.setLivePusherReference(livePusher);
108 public void startPreview(SurfaceView surfaceView)
throws IllegalArgumentException, IllegalStateException {
112 mImpl.startPreview(surfaceView);
123 public void startPreviewAsync(SurfaceView surfaceView)
throws IllegalArgumentException, IllegalStateException {
127 mImpl.startPreviewAsync(surfaceView);
141 public void startPreview(Context context, FrameLayout frameLayout,
boolean isAnchor)
throws IllegalArgumentException, IllegalStateException {
145 mImpl.startPreview(context, frameLayout, isAnchor);
169 public void startPush(String url)
throws IllegalArgumentException, IllegalStateException {
173 mImpl.startPush(AlivcLiveURLTools.trimUrl(url));
184 public void startPushAsync(String url)
throws IllegalArgumentException, IllegalStateException {
188 mImpl.startPushAsync(AlivcLiveURLTools.trimUrl(url));
214 mImpl.restartPushAsync();
228 mImpl.reconnectPushAsync(AlivcLiveURLTools.trimUrl(url));
237 public void stopPush() throws IllegalStateException {
250 public void pause() throws IllegalStateException {
263 public void resume() throws IllegalStateException {
293 mImpl.switchCamera();
303 public void setAutoFocus(
boolean autoFocus)
throws IllegalStateException {
307 mImpl.setAutoFocus(autoFocus);
323 mImpl.focusCameraAtAdjustedPoint(x, y, autoFocus);
333 public void setZoom(
int zoom)
throws IllegalArgumentException, IllegalStateException {
351 return mImpl.getMaxZoom();
365 return mImpl.getCurrentZoom();
375 public void setMute(
boolean mute)
throws IllegalStateException {
389 public void setFlash(
boolean flash)
throws IllegalStateException {
393 mImpl.setFlash(flash);
407 mImpl.setPushMirror(mirror);
421 mImpl.setPreviewMirror(mirror);
435 mImpl.setTargetVideoBitrate(targetVideoBitrate);
445 public void setMinVideoBitrate(
int minVideoBitrate)
throws IllegalArgumentException, IllegalStateException {
449 mImpl.setMinVideoBitrate(minVideoBitrate);
462 return mImpl.isCameraSupportAutoFocus();
475 return mImpl.isCameraSupportFlash();
485 public boolean isPushing() throws IllegalStateException {
489 return mImpl.isPushing();
503 return mImpl.isNetworkPushing();
516 mImpl.setCustomDetect(customVideoDetect);
529 mImpl.setCustomFilter(customVideoFilter);
542 mImpl.setCustomAudioFilter(customAudioFilter);
555 return mImpl.getCurrentStatus();
568 mImpl.setLivePushErrorListener(errorListener);
581 mImpl.setLivePushInfoListener(infoListener);
594 mImpl.setLivePushNetworkListener(networkListener);
607 mImpl.setLivePushBGMListener(pushBGMListener);
620 mImpl.setLivePushRenderContextListener(renderCtxListener);
634 return mImpl.getLivePushStatsInfo();
647 return mImpl.getPushUrl();
660 mImpl.setPreviewOrientation(orientation);
676 return mImpl.setAudioEffectVoiceChangeMode(mode);
692 return mImpl.setAudioEffectReverbMode(mode);
706 mImpl.startBGMAsync(path);
719 mImpl.stopBGMAsync();
728 public void pauseBGM() throws IllegalStateException {
755 public void setBGMLoop(
boolean isLoop)
throws IllegalStateException {
759 mImpl.setBGMLoop(isLoop);
773 mImpl.setBGMEarsBack(isOpen);
784 public void setBGMVolume(
int volume)
throws IllegalStateException, IllegalArgumentException {
788 mImpl.setBGMVolume(volume);
799 public void setCaptureVolume(
int volume)
throws IllegalStateException, IllegalArgumentException {
803 mImpl.setCaptureVolume(volume);
816 mImpl.setAudioDenoise(on);
839 return mImpl.startIntelligentDenoise();
853 return mImpl.stopIntelligentDenoise();
867 mImpl.setQualityMode(mode);
881 mImpl.setPreviewMode(mode);
894 mImpl.pauseScreenCapture();
907 mImpl.resumeScreenCapture();
920 return mImpl.getLastError();
933 mImpl.changeResolution(resolution);
950 mImpl.addWaterMark(path, x, y, width);
963 mImpl.setWatermarkVisible(visible);
974 public int startCamera(SurfaceView surfaceView)
throws IllegalStateException {
978 return mImpl.startCamera(surfaceView);
1002 mImpl.setScreenOrientation(orientation);
1016 if (mImpl == null) {
1019 return mImpl.startCameraMix(x, y, w, h);
1027 if (mImpl == null) {
1030 mImpl.stopCameraMix();
1042 if (mImpl == null) {
1045 mImpl.snapshot(count, interval, listener);
1062 public void inputStreamVideoPtr(
long dataPtr,
int width,
int height,
int stride,
int size,
long pts,
int rotation) {
1063 if (mImpl == null) {
1066 mImpl.inputStreamVideoPtr(dataPtr, width, height, stride, size, pts, rotation);
1083 public void inputStreamVideoData(byte[] data,
int width,
int height,
int stride,
int size,
long pts,
int rotation) {
1084 if (mImpl == null) {
1087 mImpl.inputStreamVideoData(data, width, height, stride, size, pts, rotation);
1103 if (mImpl == null) {
1106 mImpl.inputStreamAudioPtr(dataPtr, size, sampleRate, channels, pts);
1122 if (mImpl == null) {
1125 mImpl.inputStreamAudioData(data, size, sampleRate, channels, pts);
1140 if (mImpl == null) {
1143 return mImpl.addDynamicsAddons(path, x, y, w, h);
1153 if (mImpl == null) {
1156 mImpl.removeDynamicsAddons(
id);
1166 if (mImpl == null) {
1169 mImpl.setExposure(exposure);
1179 if (mImpl == null) {
1182 return mImpl.getCurrentExposure();
1192 if (mImpl == null) {
1195 return mImpl.getSupportedMinExposure();
1205 if (mImpl == null) {
1208 return mImpl.getSupportedMaxExposure();
1220 public void sendMessage(String info,
int repeat,
int delay,
boolean isKeyFrame) {
1221 if (mImpl == null) {
1224 mImpl.sendMessage(info, repeat, delay, isKeyFrame);
1243 if (mImpl == null) {
1246 return mImpl.setLiveMixTranscodingConfig(config);
1261 if (mImpl == null) {
1264 return mImpl.muteLocalCamera(mute);
1276 if (mImpl == null) {
1279 return mImpl.enableSpeakerphone(enable);
1290 if (mImpl == null) {
1293 return mImpl.isSpeakerphoneOn();
1304 if (mImpl == null) {
1307 return mImpl.getLiveTraceId();
Live push snapshot async callback.
void startPreviewAsync(SurfaceView surfaceView)
int getSupportedMaxExposure()
int setAudioEffectReverbMode(AlivcLivePushAudioEffectReverbMode mode)
void startPush(String url)
Live push mix transcoding config.
void inputStreamVideoData(byte[] data, int width, int height, int stride, int size, long pts, int rotation)
void snapshot(int count, int interval, AlivcSnapshotListener listener)
boolean isCameraSupportAutoFocus()
void setBGMEarsBack(boolean isOpen)
void setCaptureVolume(int volume)
void startPreview(SurfaceView surfaceView)
void changeResolution(AlivcResolutionEnum resolution)
void resumeScreenCapture()
void setLivePushNetworkListener(AlivcLivePushNetworkListener networkListener)
void init(Context context, AlivcLivePushConfig config)
void sendMessage(String info, int repeat, int delay, boolean isKeyFrame)
Live pusher abstract class.
void startPreview(Context context, FrameLayout frameLayout, boolean isAnchor)
void setMinVideoBitrate(int minVideoBitrate)
void removeDynamicsAddons(int id)
void setLivePushBGMListener(AlivcLivePushBGMListener pushBGMListener)
void setScreenOrientation(int orientation)
void setCustomDetect(AlivcLivePushCustomDetect customVideoDetect)
void pauseScreenCapture()
void setPreviewOrientation(AlivcPreviewOrientationEnum orientation)
void setMute(boolean mute)
void reconnectPushAsync(String url)
void inputStreamAudioPtr(long dataPtr, int size, int sampleRate, int channels, long pts)
void inputStreamAudioData(byte[] data, int size, int sampleRate, int channels, long pts)
AlivcLivePushError getLastError()
void setBGMVolume(int volume)
void setWatermarkVisible(boolean visible)
int addDynamicsAddons(String path, float x, float y, float w, float h)
void setPushMirror(boolean mirror)
Live push network listener.
Live push error listener.
void setCustomAudioFilter(AlivcLivePushCustomAudioFilter customAudioFilter)
int startIntelligentDenoise()
int stopIntelligentDenoise()
void setBGMLoop(boolean isLoop)
void focusCameraAtAdjustedPoint(float x, float y, boolean autoFocus)
Enumeration of streaming audio effect reverb mode.
int startCamera(SurfaceView surfaceView)
void setAudioDenoise(boolean on)
int enableSpeakerphone(boolean enable)
boolean isSpeakerphoneOn()
int startCameraMix(float x, float y, float w, float h)
void setExposure(int exposure)
void setLivePushErrorListener(AlivcLivePushErrorListener errorListener)
int setAudioEffectVoiceChangeMode(AlivcLivePushAudioEffectVoiceChangeMode mode)
void setLivePushInfoListener(AlivcLivePushInfoListener infoListener)
Customizing the filter interface.
void setTargetVideoBitrate(int targetVideoBitrate)
void setAutoFocus(boolean autoFocus)
Live push video quality mode.
Used to load sdk common instance,.
int setLiveMixTranscodingConfig(AlivcLiveTranscodingConfig config)
void setFlash(boolean flash)
void setLivePushRenderContextListener(AlivcLivePusherRenderContextListener renderCtxListener)
int muteLocalCamera(boolean mute)
Live push video resolution.
void setPreviewMirror(boolean mirror)
Customizing the audio filter interface.
int getSupportedMinExposure()
User defined video custom detect callback.
AlivcLivePushStatsInfo getLivePushStatsInfo()
void setPreviewMode(AlivcPreviewDisplayMode mode)
void setCustomFilter(AlivcLivePushCustomFilter customVideoFilter)
void inputStreamVideoPtr(long dataPtr, int width, int height, int stride, int size, long pts, int rotation)
Live push preview orientation.
void startPushAsync(String url)
Live push preview display mode.
boolean isCameraSupportFlash()
void addWaterMark(String path, float x, float y, float width)
void startBGMAsync(String path)
boolean isNetworkPushing()
void setLivePusherReference(AlivcLivePusher livePusher)
AlivcLivePushStats getCurrentStatus()
void setQualityMode(AlivcQualityModeEnum mode)
static void loadInstance(Context context)
Enumeration of streaming audio effect voice change mode.
Live push statistics info.