Skip to content

Commit 198f6e7

Browse files
Add SwitchExternalVideo module (code and comments are not organized), and fix bugs.
1 parent b901151 commit 198f6e7

29 files changed

Lines changed: 2011 additions & 246 deletions

File tree

Android/APIExample/app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android {
77

88
defaultConfig {
99
applicationId "io.agora.api.example"
10-
minSdkVersion 19
10+
minSdkVersion 21
1111
targetSdkVersion 29
1212
versionCode 1
1313
versionName "1.0"
@@ -50,4 +50,5 @@ dependencies {
5050
implementation project(path: ':lib-stream-encrypt')
5151
implementation project(path: ':lib-push-externalvideo')
5252
implementation project(path: ':lib-raw-data')
53+
implementation project(path: ':lib-switch-external-video')
5354
}

Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/ProcessRawData.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
102102
mediaDataObserverPlugin = MediaDataObserverPlugin.the();
103103
MediaPreProcessing.setCallback(mediaDataObserverPlugin);
104104
MediaPreProcessing.setVideoCaptureByteBuffer(mediaDataObserverPlugin.byteBufferCapture);
105+
MediaPreProcessing.setVideoCaptureByteBuffer(mediaDataObserverPlugin.byteBufferRender);
105106
mediaDataObserverPlugin.addVideoObserver(this);
106107
}
107108

@@ -182,8 +183,6 @@ private void joinChannel(String channelId) {
182183
fl_local.addView(surfaceView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
183184
// Setup local video to render your local camera preview
184185
engine.setupLocalVideo(new VideoCanvas(surfaceView, RENDER_MODE_HIDDEN, 0));
185-
// Set audio route to speaker
186-
engine.setDefaultAudioRoutetoSpeakerphone(true);
187186

188187
/** Sets the channel profile of the Agora RtcEngine.
189188
CHANNEL_PROFILE_COMMUNICATION(0): (Default) The Communication profile.
@@ -353,7 +352,9 @@ public void onCaptureVideoFrame(byte[] data, int frameType, int width, int heigh
353352

354353
@Override
355354
public void onRenderVideoFrame(int uid, byte[] data, int frameType, int width, int height, int bufferLength, int yStride, int uStride, int vStride, int rotation, long renderTimeMs) {
356-
355+
Bitmap bmp = YUVUtils.blur(getContext(), YUVUtils.i420ToBitmap(width, height, rotation, bufferLength, data, yStride, uStride, vStride), 10);
356+
// copy the new byte array
357+
System.arraycopy(YUVUtils.bitmapToI420(width, height, bmp), 0, data, 0, bufferLength);
357358
}
358359

359360
@Override

0 commit comments

Comments
 (0)