AliVCSDK 6.17.0
阿里云音视频SDK,为视频开发者提供一站式接入服务
 
载入中...
搜索中...
未找到
AlivcLivePusher.java
1package com.alivc.live.pusher;
2
3import android.content.Context;
4import android.graphics.Bitmap;
5import android.view.SurfaceView;
6import android.widget.FrameLayout;
7
8import com.alivc.component.custom.AlivcLivePushCustomAudioFilter;
9import com.alivc.component.custom.AlivcLivePushCustomDetect;
10import com.alivc.component.custom.AlivcLivePushCustomFilter;
11import com.alivc.live.annotations.AlivcLiveAudioEffectBeautifyMode;
12import com.alivc.live.annotations.AlivcLiveAudioEffectEqualizationBandFrequency;
13import com.alivc.live.annotations.AlivcLiveAudioEffectReverbParamType;
14import com.alivc.live.annotations.AlivcLiveAudioProfileQualityMode;
15import com.alivc.live.annotations.AlivcLiveAudioSource;
16import com.alivc.live.annotations.AlivcLiveChannelProfile;
17import com.alivc.live.annotations.AlivcLiveMode;
18import com.alivc.live.annotations.AlivcLiveMuteLocalAudioMode;
19import com.alivc.live.annotations.AlivcLiveNetworkQuality;
20import com.alivc.live.annotations.AlivcLiveRecordMediaEvent;
21import com.alivc.live.annotations.AlivcLiveVideoCodecManufacturer;
22import com.alivc.live.annotations.AlivcLiveVideoMirrorMode;
23import com.alivc.live.biz.api.ILivePusher;
24import com.alivc.live.biz.utils.AlivcLiveURLTools;
25import com.alivc.live.biz.utils.ReflectUtil;
26import com.alivc.live.player.annotations.AlivcLivePlayVideoStreamType;
27
47@CalledByNative
48public class AlivcLivePusher implements ILivePusher {
49 private ILivePusher mImpl = null;
50
51 private static final String BASIC_PUSHER_IMPL_CLASS = "com.alivc.live.pusher.basic.AlivcBasicLivePusherImpl";
52 private static final String INTERACTIVE_PUSHER_IMPL_CLASS = "com.alivc.live.pusher.rtc.AlivcRTCLivePusherImpl";
53
63 @Override
64 public void init(Context context, AlivcLivePushConfig config) throws IllegalArgumentException, IllegalStateException {
66
67 if (config == null) {
68 throw new IllegalArgumentException("Invalid parameter, config is null.");
69 }
70
71 reflectInitPusher(config.getLivePushMode());
73
74 if (mImpl == null) {
75 return;
76 }
77 mImpl.init(context, config);
78 }
79
80 private void reflectInitPusher(AlivcLiveMode mode) {
81 Object playerInstance = null;
82
84 playerInstance = ReflectUtil.reflectInit(INTERACTIVE_PUSHER_IMPL_CLASS, null, null);
85 } else {
86 playerInstance = ReflectUtil.reflectInit(BASIC_PUSHER_IMPL_CLASS, null, null);
87 }
88
89 if (playerInstance == null) {
90 throw new RuntimeException("init live pusher error! now not support mode: " + mode);
91 }
92
93 mImpl = (ILivePusher) playerInstance;
94 }
95
102 @Override
103 public void destroy() throws IllegalStateException {
104 if (mImpl == null) {
105 return;
106 }
107 mImpl.destroy();
109 }
110
116 @Override
117 public void setLivePusherReference(AlivcLivePusher livePusher) {
118 if (mImpl == null) {
119 return;
120 }
121 mImpl.setLivePusherReference(livePusher);
122 }
123
136 @Override
137 public void startPreview(SurfaceView surfaceView) throws IllegalArgumentException, IllegalStateException {
138 if (mImpl == null) {
139 return;
140 }
141 mImpl.startPreview(surfaceView);
142 }
143
156 @Override
157 public void startPreviewAsync(SurfaceView surfaceView) throws IllegalArgumentException, IllegalStateException {
158 if (mImpl == null) {
159 return;
160 }
161 mImpl.startPreviewAsync(surfaceView);
162 }
163
180 @Override
181 public void startPreview(Context context, FrameLayout frameLayout, boolean isFullScreen) throws IllegalArgumentException, IllegalStateException {
182 if (mImpl == null) {
183 return;
184 }
185 mImpl.startPreview(context, frameLayout, isFullScreen);
186 }
187
197 @Override
198 public void updatePreview(Context context, FrameLayout frameLayout, boolean isFullScreen) {
199 if (mImpl == null) {
200 return;
201 }
202 mImpl.updatePreview(context, frameLayout, isFullScreen);
203 }
204
211 @Override
212 public void stopPreview() throws IllegalStateException {
213 if (mImpl == null) {
214 return;
215 }
216 mImpl.stopPreview();
217 }
218
231 @Override
232 public void startPush(String url) throws IllegalArgumentException, IllegalStateException {
233 if (mImpl == null) {
234 return;
235 }
236 mImpl.startPush(AlivcLiveURLTools.trimUrl(url));
237 }
238
249 @Override
250 public void startPushAsync(String url) throws IllegalArgumentException, IllegalStateException {
251 if (mImpl == null) {
252 return;
253 }
254 mImpl.startPushAsync(AlivcLiveURLTools.trimUrl(url));
255 }
256
265 @Override
266 public void restartPush() throws IllegalStateException {
267 if (mImpl == null) {
268 return;
269 }
270 mImpl.restartPush();
271 }
272
281 @Override
282 public void restartPushAsync() throws IllegalStateException {
283 if (mImpl == null) {
284 return;
285 }
286 mImpl.restartPushAsync();
287 }
288
296 @Override
297 public void reconnectPushAsync(String url) throws IllegalStateException {
298 if (mImpl == null) {
299 return;
300 }
301 mImpl.reconnectPushAsync(AlivcLiveURLTools.trimUrl(url));
302 }
303
309 @Override
310 public void stopPush() throws IllegalStateException {
311 if (mImpl == null) {
312 return;
313 }
314 mImpl.stopPush();
315 }
316
326 @Override
327 public void pause() throws IllegalStateException {
328 if (mImpl == null) {
329 return;
330 }
331 mImpl.pause();
332 }
333
341 @Override
342 public void resume() throws IllegalStateException {
343 if (mImpl == null) {
344 return;
345 }
346 mImpl.resume();
347 }
348
356 @Override
357 public void resumeAsync() throws IllegalStateException {
358 if (mImpl == null) {
359 return;
360 }
361 mImpl.resumeAsync();
362 }
363
369 @Override
370 public void switchCamera() throws IllegalStateException {
371 if (mImpl == null) {
372 return;
373 }
374 mImpl.switchCamera();
375 }
376
383 @Override
384 public void setAutoFocus(boolean autoFocus) throws IllegalStateException {
385 if (mImpl == null) {
386 return;
387 }
388 mImpl.setAutoFocus(autoFocus);
389 }
390
399 @Override
400 public void focusCameraAtAdjustedPoint(float x, float y, boolean autoFocus) throws IllegalArgumentException, IllegalStateException {
401 if (mImpl == null) {
402 return;
403 }
404 mImpl.focusCameraAtAdjustedPoint(x, y, autoFocus);
405 }
406
413 @Override
414 public void setZoom(int zoom) throws IllegalArgumentException, IllegalStateException {
415 if (mImpl == null) {
416 return;
417 }
418 mImpl.setZoom(zoom);
419 }
420
427 @Override
428 public int getMaxZoom() throws IllegalStateException {
429 if (mImpl == null) {
430 return -1;
431 }
432 return mImpl.getMaxZoom();
433 }
434
441 @Override
442 public int getCurrentZoom() throws IllegalStateException {
443 if (mImpl == null) {
444 return -1;
445 }
446 return mImpl.getCurrentZoom();
447 }
448
458 @Override
459 public void setMute(boolean mute) throws IllegalStateException {
460 if (mImpl == null) {
461 return;
462 }
463 mImpl.setMute(mute);
464 }
465
476 @Override
477 public void setMute(boolean mute, AlivcLiveMuteLocalAudioMode muteLocalAudioMode) {
478 if (mImpl == null) {
479 return;
480 }
481 mImpl.setMute(mute, muteLocalAudioMode);
482 }
483
490 @Override
491 public void setFlash(boolean flash) throws IllegalStateException {
492 if (mImpl == null) {
493 return;
494 }
495 mImpl.setFlash(flash);
496 }
497
504 @Override
505 public void setPushMirror(boolean mirror) throws IllegalStateException {
506 if (mImpl == null) {
507 return;
508 }
509 mImpl.setPushMirror(mirror);
510 }
511
518 @Override
519 public void setPreviewMirror(boolean mirror) throws IllegalStateException {
520 if (mImpl == null) {
521 return;
522 }
523 mImpl.setPreviewMirror(mirror);
524 }
525
534 @Override
536 if (mImpl == null) {
537 return -1;
538 }
539 return mImpl.setVideoMirrorMode(mirrorMode);
540 }
541
548 @Override
549 public void setVideoConfig(AlivcLivePushVideoConfig videoConfig) {
550 if (mImpl != null) {
551 mImpl.setVideoConfig(videoConfig);
552 }
553 }
554
561 @Override
563 if (mImpl == null) {
564 return null;
565 }
566 return mImpl.getVideoConfig();
567 }
568
576 @Override
577 public void setTargetVideoBitrate(int targetVideoBitrate) throws IllegalArgumentException, IllegalStateException {
578 if (mImpl == null) {
579 return;
580 }
581 mImpl.setTargetVideoBitrate(targetVideoBitrate);
582 }
583
591 @Override
592 public void setMinVideoBitrate(int minVideoBitrate) throws IllegalArgumentException, IllegalStateException {
593 if (mImpl == null) {
594 return;
595 }
596 mImpl.setMinVideoBitrate(minVideoBitrate);
597 }
598
607 @Override
608 public void refreshPushURLToken(String url) {
609 if (mImpl == null) {
610 return;
611 }
612 mImpl.refreshPushURLToken(url);
613 }
614
620 @Override
621 public boolean isCameraSupportAutoFocus() {
622 if (mImpl == null) {
623 return false;
624 }
625 return mImpl.isCameraSupportAutoFocus();
626 }
627
633 @Override
634 public boolean isCameraSupportFlash() {
635 if (mImpl == null) {
636 return false;
637 }
638 return mImpl.isCameraSupportFlash();
639 }
640
647 @Override
648 public boolean isPushing() throws IllegalStateException {
649 if (mImpl == null) {
650 return false;
651 }
652 return mImpl.isPushing();
653 }
654
661 @Override
662 public boolean isNetworkPushing() throws IllegalStateException {
663 if (mImpl == null) {
664 return false;
665 }
666 return mImpl.isNetworkPushing();
667 }
668
674 @Override
675 public void setCustomDetect(AlivcLivePushCustomDetect customVideoDetect) {
676 if (mImpl == null) {
677 return;
678 }
679 mImpl.setCustomDetect(customVideoDetect);
680 }
681
687 @Override
688 public void setCustomFilter(AlivcLivePushCustomFilter customVideoFilter) {
689 if (mImpl == null) {
690 return;
691 }
692 mImpl.setCustomFilter(customVideoFilter);
693 }
694
700 @Override
702 if (mImpl == null) {
703 return;
704 }
705 mImpl.setCustomAudioFilter(customAudioFilter);
706 }
707
714 @Override
716 if (mImpl == null) {
718 }
719 return mImpl.getCurrentStatus();
720 }
721
730 @Override
732 if (mImpl == null) {
733 return;
734 }
735 mImpl.setLivePushErrorListener(errorListener);
736 }
737
744 @Override
746 if (mImpl == null) {
747 return;
748 }
749 mImpl.setLivePushInfoListener(infoListener);
750 }
751
758 @Override
760 if (mImpl == null) {
761 return;
762 }
763 mImpl.setLivePushNetworkListener(networkListener);
764 }
765
772 @Override
774 if (mImpl == null) {
775 return;
776 }
777 mImpl.setLivePushBGMListener(pushBGMListener);
778 }
779
786 @Override
788 if (mImpl == null) {
789 return;
790 }
791 mImpl.setLivePushAudioFrameListener(pushAudioFrameListener);
792 }
793
799 @Override
800 public void setLivePushRenderContextListener(AlivcLivePusherRenderContextListener renderCtxListener) {
801 if (mImpl == null) {
802 return;
803 }
804 mImpl.setLivePushRenderContextListener(renderCtxListener);
805 }
806
813 @Override
814 public AlivcLivePushStatsInfo getLivePushStatsInfo() throws IllegalStateException {
815 if (mImpl == null) {
816 return null;
817 }
818 return mImpl.getLivePushStatsInfo();
819 }
820
826 @Override
827 public String getPushUrl() {
828 if (mImpl == null) {
829 return "";
830 }
831 return mImpl.getPushUrl();
832 }
833
841 @Override
842 public int setParameter(String parameter) {
843 if (mImpl == null) {
844 return -1;
845 }
846 return mImpl.setParameter(parameter);
847 }
848
856 @Override
857 public String getParameter(String parameter) {
858 if (mImpl == null) {
859 return "";
860 }
861 return mImpl.getParameter(parameter);
862 }
863
869 @Override
871 if (mImpl == null) {
872 return;
873 }
874 mImpl.setPreviewOrientation(orientation);
875 }
876
885 @Deprecated
886 @Override
887 public int startBGMAsync(String path) throws IllegalStateException {
888 if (mImpl == null) {
889 return -1;
890 }
891 return mImpl.startBGMAsync(path);
892 }
893
903 @Override
904 public int startBGMAsync(String path, AlivcLiveBGMConfig bgmConfig) {
905 if (mImpl == null) {
906 return -1;
907 }
908 return mImpl.startBGMAsync(path, bgmConfig);
909 }
910
916 @Override
917 public void stopBGMAsync() throws IllegalStateException {
918 if (mImpl == null) {
919 return;
920 }
921 mImpl.stopBGMAsync();
922 }
923
931 @Override
932 public int getBGMDuration() {
933 if (mImpl == null) {
934 return -1;
935 }
936 return mImpl.getBGMDuration();
937 }
938
946 @Override
948 if (mImpl == null) {
949 return -1;
950 }
951 return mImpl.getBGMCurrentPosition();
952 }
953
959 @Override
960 public void pauseBGM() throws IllegalStateException {
961 if (mImpl == null) {
962 return;
963 }
964 mImpl.pauseBGM();
965 }
966
972 @Override
973 public void resumeBGM() throws IllegalStateException {
974 if (mImpl == null) {
975 return;
976 }
977 mImpl.resumeBGM();
978 }
979
986 @Override
987 public void setBGMLoop(boolean isLoop) throws IllegalStateException {
988 if (mImpl == null) {
989 return;
990 }
991 mImpl.setBGMLoop(isLoop);
992 }
993
1000 @Override
1001 public void setBGMEarsBack(boolean isOpen) throws IllegalStateException {
1002 if (mImpl == null) {
1003 return;
1004 }
1005 mImpl.setBGMEarsBack(isOpen);
1006 }
1007
1015 @Override
1016 public void setBGMVolume(int volume) throws IllegalStateException, IllegalArgumentException {
1017 if (mImpl == null) {
1018 return;
1019 }
1020 mImpl.setBGMVolume(volume);
1021 }
1022
1030 @Override
1031 public void setCaptureVolume(int volume) throws IllegalStateException, IllegalArgumentException {
1032 if (mImpl == null) {
1033 return;
1034 }
1035 mImpl.setCaptureVolume(volume);
1036 }
1037
1046 @Override
1047 public void setAudioDenoise(boolean enable) {
1048 if (mImpl == null) {
1049 return;
1050 }
1051 mImpl.setAudioDenoise(enable);
1052 }
1053
1069 @Override
1071 if (mImpl == null) {
1072 return -1;
1073 }
1074 return mImpl.startIntelligentDenoise();
1075 }
1076
1083 @Override
1085 if (mImpl == null) {
1086 return -1;
1087 }
1088 return mImpl.stopIntelligentDenoise();
1089 }
1090
1097 @Override
1098 public void setQualityMode(AlivcQualityModeEnum mode) throws IllegalStateException {
1099 if (mImpl == null) {
1100 return;
1101 }
1102 mImpl.setQualityMode(mode);
1103 }
1104
1111 @Override
1112 public void setPreviewMode(AlivcPreviewDisplayMode mode) throws IllegalStateException {
1113 if (mImpl == null) {
1114 return;
1115 }
1116 mImpl.setPreviewMode(mode);
1117 }
1118
1124 @Override
1125 public void pauseScreenCapture() throws IllegalStateException {
1126 if (mImpl == null) {
1127 return;
1128 }
1129 mImpl.pauseScreenCapture();
1130 }
1131
1137 @Override
1138 public void resumeScreenCapture() throws IllegalStateException {
1139 if (mImpl == null) {
1140 return;
1141 }
1142 mImpl.resumeScreenCapture();
1143 }
1144
1151 @Override
1153 if (mImpl == null) {
1154 return null;
1155 }
1156 return mImpl.getVideoCodecType();
1157 }
1158
1164 @Override
1166 if (mImpl == null) {
1167 return AlivcLivePushError.ALIVC_COMMON_RETURN_SUCCESS;
1168 }
1169 return mImpl.getLastError();
1170 }
1171
1183 @Override
1184 public void changeResolution(AlivcResolutionEnum resolution) {
1185 if (mImpl == null) {
1186 return;
1187 }
1188 mImpl.changeResolution(resolution);
1189 }
1190
1201 @Override
1202 public void addWaterMark(String path, float x, float y, float width) {
1203 if (mImpl == null) {
1204 return;
1205 }
1206 mImpl.addWaterMark(path, x, y, width);
1207 }
1208
1220 @Override
1221 public void addWaterMark(Bitmap bitmap, float x, float y, float width) {
1222 if (mImpl == null) {
1223 return;
1224 }
1225 mImpl.addWaterMark(bitmap, x, y, width);
1226 }
1227
1233 @Override
1234 public void setWatermarkVisible(boolean visible) {
1235 if (mImpl == null) {
1236 return;
1237 }
1238 mImpl.setWatermarkVisible(visible);
1239 }
1240
1248 @Override
1249 public int startCamera(SurfaceView surfaceView) throws IllegalStateException {
1250 if (mImpl == null) {
1251 return -1;
1252 }
1253 return mImpl.startCamera(surfaceView);
1254 }
1255
1259 @Override
1260 public void stopCamera() {
1261 if (mImpl == null) {
1262 return;
1263 }
1264 mImpl.stopCamera();
1265 }
1266
1272 @Override
1273 public void setScreenOrientation(int orientation) {
1274 if (mImpl == null) {
1275 return;
1276 }
1277 mImpl.setScreenOrientation(orientation);
1278 }
1279
1289 @Override
1290 public int startCameraMix(float x, float y, float w, float h) {
1291 if (mImpl == null) {
1292 return -1;
1293 }
1294 return mImpl.startCameraMix(x, y, w, h);
1295 }
1296
1300 @Override
1301 public void stopCameraMix() {
1302 if (mImpl == null) {
1303 return;
1304 }
1305 mImpl.stopCameraMix();
1306 }
1307
1318 @Override
1319 public boolean startLocalRecord(AlivcLiveLocalRecordConfig localRecordConfig) {
1320 if (mImpl == null) {
1321 return false;
1322 }
1323 return mImpl.startLocalRecord(localRecordConfig);
1324 }
1325
1334 @Override
1335 public void stopLocalRecord() {
1336 if (mImpl == null) {
1337 return;
1338 }
1339 mImpl.stopLocalRecord();
1340 }
1341
1349 @Override
1350 public int startScreenShare() {
1351 if (mImpl == null) {
1352 return -1;
1353 }
1354 return mImpl.startScreenShare();
1355 }
1356
1363 @Override
1364 public int stopScreenShare() {
1365 if (mImpl == null) {
1366 return -1;
1367 }
1368 return mImpl.stopScreenShare();
1369 }
1370
1381 @Override
1383 if (mImpl == null) {
1384 return -1;
1385 }
1386 return mImpl.startLocalDualAudioStream();
1387 }
1388
1396 @Override
1398 if (mImpl == null) {
1399 return -1;
1400 }
1401 return mImpl.stopLocalDualAudioStream();
1402 }
1403
1411 @Override
1412 public void snapshot(int count, int interval, AlivcSnapshotListener listener) {
1413 if (mImpl == null) {
1414 return;
1415 }
1416 mImpl.snapshot(count, interval, listener);
1417 }
1418
1428 @Override
1429 public void setExternalVideoSource(boolean enable, boolean useTexture, AlivcLivePlayVideoStreamType videoStreamType, AlivcPreviewDisplayMode previewDisplayMode) {
1430 if (mImpl == null) {
1431 return;
1432 }
1433 mImpl.setExternalVideoSource(enable, useTexture, videoStreamType, previewDisplayMode);
1434 }
1435
1445 @Override
1447 if (mImpl == null) {
1448 return -1;
1449 }
1450 return mImpl.pushExternalVideoFrame(rawDataSample, videoStreamType);
1451 }
1452
1460 @Override
1461 public int setMixedWithMic(boolean mixed) {
1462 if (mImpl == null) {
1463 return -1;
1464 }
1465 return mImpl.setMixedWithMic(mixed);
1466 }
1467
1475 @Override
1477 if (mImpl == null) {
1478 return -1;
1479 }
1480 return mImpl.addExternalAudioStream(externalAudioStreamConfig);
1481 }
1482
1492 @Override
1493 public int pushExternalAudioStream(int streamId, AlivcLivePushAudioFrame audioFrame) {
1494 if (mImpl == null) {
1495 return -1;
1496 }
1497 return mImpl.pushExternalAudioStream(streamId, audioFrame);
1498 }
1499
1508 @Override
1509 public int setExternalAudioStreamPlayoutVolume(int streamId, int playoutVolume) {
1510 if (mImpl == null) {
1511 return -1;
1512 }
1513 return mImpl.setExternalAudioStreamPlayoutVolume(streamId, playoutVolume);
1514 }
1515
1524 @Override
1525 public int setExternalAudioStreamPublishVolume(int streamId, int publishVolume) {
1526 if (mImpl == null) {
1527 return -1;
1528 }
1529 return mImpl.setExternalAudioStreamPublishVolume(streamId, publishVolume);
1530 }
1531
1539 @Override
1540 public int removeExternalAudioStream(int streamId) {
1541 if (mImpl == null) {
1542 return -1;
1543 }
1544 return mImpl.removeExternalAudioStream(streamId);
1545 }
1546
1560 @Deprecated
1561 @Override
1562 public void inputStreamVideoPtr(long dataPtr, int width, int height, int stride, int size, long pts, int rotation) {
1563 if (mImpl == null) {
1564 return;
1565 }
1566 mImpl.inputStreamVideoPtr(dataPtr, width, height, stride, size, pts, rotation);
1567 }
1568
1581 @Override
1582 public void inputStreamVideoData(byte[] data, int width, int height, int stride, int size, long pts, int rotation) {
1583 if (mImpl == null) {
1584 return;
1585 }
1586 mImpl.inputStreamVideoData(data, width, height, stride, size, pts, rotation);
1587 }
1588
1600 @Deprecated
1601 @Override
1602 public void inputStreamAudioPtr(long dataPtr, int size, int sampleRate, int channels, long pts) {
1603 if (mImpl == null) {
1604 return;
1605 }
1606 mImpl.inputStreamAudioPtr(dataPtr, size, sampleRate, channels, pts);
1607 }
1608
1619 @Override
1620 public void inputStreamAudioData(byte[] data, int size, int sampleRate, int channels, long pts) {
1621 if (mImpl == null) {
1622 return;
1623 }
1624 mImpl.inputStreamAudioData(data, size, sampleRate, channels, pts);
1625 }
1626
1638 @Override
1639 public int addDynamicsAddons(String path, float x, float y, float w, float h) {
1640 if (mImpl == null) {
1641 return -1;
1642 }
1643 return mImpl.addDynamicsAddons(path, x, y, w, h);
1644 }
1645
1651 @Override
1652 public void removeDynamicsAddons(int id) {
1653 if (mImpl == null) {
1654 return;
1655 }
1656 mImpl.removeDynamicsAddons(id);
1657 }
1658
1664 @Override
1665 public void setExposure(int exposure) {
1666 if (mImpl == null) {
1667 return;
1668 }
1669 mImpl.setExposure(exposure);
1670 }
1671
1677 @Override
1678 public int getCurrentExposure() {
1679 if (mImpl == null) {
1680 return -1;
1681 }
1682 return mImpl.getCurrentExposure();
1683 }
1684
1690 @Override
1692 if (mImpl == null) {
1693 return -1;
1694 }
1695 return mImpl.getSupportedMinExposure();
1696 }
1697
1703 @Override
1705 if (mImpl == null) {
1706 return -1;
1707 }
1708 return mImpl.getSupportedMaxExposure();
1709 }
1710
1721 @Override
1722 public int enableSEIVideoStream(boolean enable) {
1723 if (mImpl == null) {
1724 return -1;
1725 }
1726 return mImpl.enableSEIVideoStream(enable);
1727 }
1728
1744 @Override
1745 public void sendMessage(String info, int repeat, int delay, boolean isKeyFrame) {
1746 if (mImpl == null) {
1747 return;
1748 }
1749 mImpl.sendMessage(info, repeat, delay, isKeyFrame);
1750 }
1751
1769 @Override
1770 public void sendMessage(String info, int repeat, int delay, boolean isKeyFrame, int payloadType) {
1771 if (mImpl == null) {
1772 return;
1773 }
1774 mImpl.sendMessage(info, repeat, delay, isKeyFrame, payloadType);
1775 }
1776
1786 @Override
1787 public int sendDataChannelMessage(String message) {
1788 if (mImpl == null) {
1789 return -1;
1790 }
1791 return mImpl.sendDataChannelMessage(message);
1792 }
1793
1812 @Override
1814 if (mImpl == null) {
1815 return -1;
1816 }
1817 return mImpl.setLiveMixTranscodingConfig(config);
1818 }
1819
1832 @Override
1833 public int muteLocalCamera(boolean mute) {
1834 if (mImpl == null) {
1835 return -1;
1836 }
1837 return mImpl.muteLocalCamera(mute);
1838 }
1839
1850 @Override
1851 public int enableLocalCamera(boolean enable) {
1852 if (mImpl == null) {
1853 return -1;
1854 }
1855 return mImpl.enableLocalCamera(enable);
1856 }
1857
1868 @Override
1869 public int startAudioCapture(boolean keepAlive) {
1870 if (mImpl == null) {
1871 return -1;
1872 }
1873 return mImpl.startAudioCapture(keepAlive);
1874 }
1875
1886 @Override
1887 public int stopAudioCapture() {
1888 if (mImpl == null) {
1889 return -1;
1890 }
1891 return mImpl.stopAudioCapture();
1892 }
1893
1901 @Override
1902 public int enableSpeakerphone(boolean enable) {
1903 if (mImpl == null) {
1904 return -1;
1905 }
1906 return mImpl.enableSpeakerphone(enable);
1907 }
1908
1915 @Override
1916 public boolean isSpeakerphoneOn() {
1917 if (mImpl == null) {
1918 return false;
1919 }
1920 return mImpl.isSpeakerphoneOn();
1921 }
1922
1931 @Override
1932 public int setChannelProfile(AlivcLiveChannelProfile channelProfile) {
1933 if (mImpl == null) {
1934 return -1;
1935 }
1936 return mImpl.setChannelProfile(channelProfile);
1937 }
1938
1946 @Override
1947 public int setAudioProfile(AlivcLiveAudioProfileQualityMode audioProfileQualityMode) {
1948 if (mImpl == null) {
1949 return -1;
1950 }
1951 return mImpl.setAudioProfile(audioProfileQualityMode);
1952 }
1953
1962 @Override
1964 if (mImpl == null) {
1965 return -1;
1966 }
1967 return mImpl.setAudioEffectVoiceChangeMode(mode);
1968 }
1969
1978 @Override
1980 if (mImpl == null) {
1981 return -1;
1982 }
1983 return mImpl.setAudioEffectReverbMode(mode);
1984 }
1985
1994 @Override
1995 public int setAudioEffectPitchValue(double value) {
1996 if (mImpl == null) {
1997 return -1;
1998 }
1999 return mImpl.setAudioEffectPitchValue(value);
2000 }
2001
2010 @Override
2012 if (mImpl == null) {
2013 return -1;
2014 }
2015 return mImpl.setAudioEffectBeautifyMode(audioEffectBeautifyMode);
2016 }
2017
2027 @Override
2028 public int setAudioEffectReverbParamType(AlivcLiveAudioEffectReverbParamType audioEffectReverbParamType, float value) {
2029 if (mImpl == null) {
2030 return -1;
2031 }
2032 return mImpl.setAudioEffectReverbParamType(audioEffectReverbParamType, value);
2033 }
2034
2045 @Override
2046 public int setAudioEffectEqualizationParam(AlivcLiveAudioEffectEqualizationBandFrequency audioEffectEqualizationBandFrequency, float gain) {
2047 if (mImpl == null) {
2048 return -1;
2049 }
2050 return mImpl.setAudioEffectEqualizationParam(audioEffectEqualizationBandFrequency, gain);
2051 }
2052
2065 @Override
2066 public int enableAudioVolumeIndication(int interval, int smooth, int reportVad) {
2067 if (mImpl == null) {
2068 return -1;
2069 }
2070 return mImpl.enableAudioVolumeIndication(interval, smooth, reportVad);
2071 }
2072
2085 @Override
2087 if (mImpl == null) {
2088 return -1;
2089 }
2090 return mImpl.enableAudioFrameObserver(enable, audioSource, config);
2091 }
2092
2102 @Override
2103 public int preloadAudioEffect(int soundId, String filePath) {
2104 if (mImpl == null) {
2105 return -1;
2106 }
2107 return mImpl.preloadAudioEffect(soundId, filePath);
2108 }
2109
2117 @Override
2118 public int unloadAudioEffect(int soundId) {
2119 if (mImpl == null) {
2120 return -1;
2121 }
2122 return mImpl.unloadAudioEffect(soundId);
2123 }
2124
2135 @Override
2136 public int playAudioEffect(int soundId, String filePath, AlivcLiveAudioEffectConfig config) {
2137 if (mImpl == null) {
2138 return -1;
2139 }
2140 return mImpl.playAudioEffect(soundId, filePath, config);
2141 }
2142
2150 @Override
2151 public int stopAudioEffect(int soundId) {
2152 if (mImpl == null) {
2153 return -1;
2154 }
2155 return mImpl.stopAudioEffect(soundId);
2156 }
2157
2164 @Override
2165 public int stopAllAudioEffects() {
2166 if (mImpl == null) {
2167 return -1;
2168 }
2169 return mImpl.stopAllAudioEffects();
2170 }
2171
2180 @Override
2181 public int setAudioEffectPublishVolume(int soundId, int volume) {
2182 if (mImpl == null) {
2183 return -1;
2184 }
2185 return mImpl.setAudioEffectPublishVolume(soundId, volume);
2186 }
2187
2195 @Override
2196 public int getAudioEffectPublishVolume(int soundId) {
2197 if (mImpl == null) {
2198 return -1;
2199 }
2200 return mImpl.getAudioEffectPublishVolume(soundId);
2201 }
2202
2211 @Override
2212 public int setAudioEffectPlayoutVolume(int soundId, int volume) {
2213 if (mImpl == null) {
2214 return -1;
2215 }
2216 return mImpl.setAudioEffectPlayoutVolume(soundId, volume);
2217 }
2218
2226 @Override
2227 public int getAudioEffectPlayoutVolume(int soundId) {
2228 if (mImpl == null) {
2229 return -1;
2230 }
2231 return mImpl.getAudioEffectPlayoutVolume(soundId);
2232 }
2233
2241 @Override
2242 public int setAllAudioEffectsPublishVolume(int volume) {
2243 if (mImpl == null) {
2244 return -1;
2245 }
2246 return mImpl.setAllAudioEffectsPublishVolume(volume);
2247 }
2248
2256 @Override
2257 public int setAllAudioEffectsPlayoutVolume(int volume) {
2258 if (mImpl == null) {
2259 return -1;
2260 }
2261 return mImpl.setAllAudioEffectsPlayoutVolume(volume);
2262 }
2263
2271 @Override
2272 public int pauseAudioEffect(int soundId) {
2273 if (mImpl == null) {
2274 return -1;
2275 }
2276 return mImpl.pauseAudioEffect(soundId);
2277 }
2278
2285 @Override
2287 if (mImpl == null) {
2288 return -1;
2289 }
2290 return mImpl.pauseAllAudioEffects();
2291 }
2292
2300 @Override
2301 public int resumeAudioEffect(int soundId) {
2302 if (mImpl == null) {
2303 return -1;
2304 }
2305 return mImpl.resumeAudioEffect(soundId);
2306 }
2307
2314 @Override
2316 if (mImpl == null) {
2317 return -1;
2318 }
2319 return mImpl.resumeAllAudioEffects();
2320 }
2321
2332 @Override
2333 public int startLastMileDetect(AlivcLiveNetworkQualityProbeConfig networkQualityProbeConfig) {
2334 if (mImpl == null) {
2335 return -1;
2336 }
2337 return mImpl.startLastMileDetect(networkQualityProbeConfig);
2338 }
2339
2346 @Override
2347 public int stopLastMileDetect() {
2348 if (mImpl == null) {
2349 return -1;
2350 }
2351 return mImpl.stopLastMileDetect();
2352 }
2353
2361 @Override
2363 if (mImpl == null) {
2365 }
2366 return mImpl.getCurrentEncoderManufacturer(isCameraStream);
2367 }
2368
2375 @Override
2376 public String getLiveTraceId() {
2377 if (mImpl == null) {
2378 return "";
2379 }
2380 return mImpl.getLiveTraceId();
2381 }
2382}
2383 // end of live_pusher
「主要API」推流接口类
int setLiveMixTranscodingConfig(AlivcLiveTranscodingConfig config)
void startPreview(SurfaceView surfaceView)
int startBGMAsync(String path, AlivcLiveBGMConfig bgmConfig)
int setVideoMirrorMode(AlivcLiveVideoMirrorMode mirrorMode)
int setAudioEffectVoiceChangeMode(AlivcLivePushAudioEffectVoiceChangeMode mode)
void addWaterMark(Bitmap bitmap, float x, float y, float width)
int enableAudioVolumeIndication(int interval, int smooth, int reportVad)
void setQualityMode(AlivcQualityModeEnum mode)
int setExternalAudioStreamPlayoutVolume(int streamId, int playoutVolume)
int setAudioEffectReverbParamType(AlivcLiveAudioEffectReverbParamType audioEffectReverbParamType, float value)
int addExternalAudioStream(AlivcLivePushExternalAudioStreamConfig externalAudioStreamConfig)
int startCamera(SurfaceView surfaceView)
void setLivePushInfoListener(AlivcLivePushInfoListener infoListener)
int setChannelProfile(AlivcLiveChannelProfile channelProfile)
int addDynamicsAddons(String path, float x, float y, float w, float h)
void setCustomFilter(AlivcLivePushCustomFilter customVideoFilter)
void changeResolution(AlivcResolutionEnum resolution)
int pushExternalVideoFrame(AlivcLivePusherRawDataSample rawDataSample, AlivcLivePlayVideoStreamType videoStreamType)
int startLastMileDetect(AlivcLiveNetworkQualityProbeConfig networkQualityProbeConfig)
void snapshot(int count, int interval, AlivcSnapshotListener listener)
void setPreviewOrientation(AlivcPreviewOrientationEnum orientation)
void setMinVideoBitrate(int minVideoBitrate)
void setLivePushRenderContextListener(AlivcLivePusherRenderContextListener renderCtxListener)
void setPreviewMode(AlivcPreviewDisplayMode mode)
AlivcLivePushVideoConfig getVideoConfig()
void inputStreamVideoData(byte[] data, int width, int height, int stride, int size, long pts, int rotation)
void setTargetVideoBitrate(int targetVideoBitrate)
int enableAudioFrameObserver(boolean enable, AlivcLiveAudioSource audioSource, AlivcLiveAudioFrameObserverConfig config)
void inputStreamAudioData(byte[] data, int size, int sampleRate, int channels, long pts)
int setExternalAudioStreamPublishVolume(int streamId, int publishVolume)
void addWaterMark(String path, float x, float y, float width)
int setAudioEffectBeautifyMode(AlivcLiveAudioEffectBeautifyMode audioEffectBeautifyMode)
int startCameraMix(float x, float y, float w, float h)
void inputStreamVideoPtr(long dataPtr, int width, int height, int stride, int size, long pts, int rotation)
int setAudioEffectPlayoutVolume(int soundId, int volume)
boolean startLocalRecord(AlivcLiveLocalRecordConfig localRecordConfig)
void setMute(boolean mute, AlivcLiveMuteLocalAudioMode muteLocalAudioMode)
void updatePreview(Context context, FrameLayout frameLayout, boolean isFullScreen)
void sendMessage(String info, int repeat, int delay, boolean isKeyFrame, int payloadType)
int setAudioEffectReverbMode(AlivcLivePushAudioEffectReverbMode mode)
int setAudioEffectEqualizationParam(AlivcLiveAudioEffectEqualizationBandFrequency audioEffectEqualizationBandFrequency, float gain)
int preloadAudioEffect(int soundId, String filePath)
void startPreviewAsync(SurfaceView surfaceView)
void init(Context context, AlivcLivePushConfig config)
void setLivePushAudioFrameListener(AlivcLivePushAudioFrameListener pushAudioFrameListener)
void startPreview(Context context, FrameLayout frameLayout, boolean isFullScreen)
void focusCameraAtAdjustedPoint(float x, float y, boolean autoFocus)
AlivcLiveVideoCodecManufacturer getCurrentEncoderManufacturer(boolean isCameraStream)
void setLivePushBGMListener(AlivcLivePushBGMListener pushBGMListener)
void sendMessage(String info, int repeat, int delay, boolean isKeyFrame)
void inputStreamAudioPtr(long dataPtr, int size, int sampleRate, int channels, long pts)
void setLivePusherReference(AlivcLivePusher livePusher)
int pushExternalAudioStream(int streamId, AlivcLivePushAudioFrame audioFrame)
void setLivePushNetworkListener(AlivcLivePushNetworkListener networkListener)
void setVideoConfig(AlivcLivePushVideoConfig videoConfig)
void setExternalVideoSource(boolean enable, boolean useTexture, AlivcLivePlayVideoStreamType videoStreamType, AlivcPreviewDisplayMode previewDisplayMode)
int playAudioEffect(int soundId, String filePath, AlivcLiveAudioEffectConfig config)
void setCustomDetect(AlivcLivePushCustomDetect customVideoDetect)
int setAudioProfile(AlivcLiveAudioProfileQualityMode audioProfileQualityMode)
int setAudioEffectPublishVolume(int soundId, int volume)
void setLivePushErrorListener(AlivcLivePushErrorListener errorListener)
AlivcLivePushStatsInfo getLivePushStatsInfo()
void setCustomAudioFilter(AlivcLivePushCustomAudioFilter customAudioFilter)
推流截图结果异步回调通知
定制filter接口(视频前处理回调)