Skip to content

Commit a2384a3

Browse files
author
Xia Ning
committed
fix gradle build issue
1 parent 185a6e8 commit a2384a3

8 files changed

Lines changed: 26 additions & 9 deletions

File tree

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.agora.api.example.examples.advanced;
22

3+
import android.annotation.TargetApi;
34
import android.content.Context;
45
import android.graphics.Bitmap;
56
import android.opengl.GLES20;
@@ -747,12 +748,18 @@ public void onDrawFrame(GL10 gl10) {
747748
mVirtualObject.draw(viewmtx, projmtx, lightIntensity);
748749
mVirtualObjectShadow.draw(viewmtx, projmtx, lightIntensity);
749750
}
750-
751-
sendARViewMessage();
751+
sendmessage();
752752

753753
} catch (Throwable t) {
754754
// Avoid crashing the application due to unhandled exceptions.
755755
Log.e(TAG, "Exception on the OpenGL thread", t);
756756
}
757757
}
758+
759+
@TargetApi(24)
760+
private void sendmessage(){
761+
sendARViewMessage();
762+
}
763+
764+
758765
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public void onStreamMessage(int uid, int streamId, byte[] data) {
470470
handler.post(new Runnable() {
471471
@Override
472472
public void run() {
473-
Toast.makeText(getContext(), String.format(getString(R.string.received), string), 300).show();
473+
Toast.makeText(getContext(), String.format(getString(R.string.received), string), Toast.LENGTH_LONG).show();
474474
}
475475
});
476476
Log.i(TAG, "onStreamMessage:" + data);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public byte[] onReadyToSendMetadata(long timeStampMs)
302302
handler.post(new Runnable() {
303303
@Override
304304
public void run() {
305-
Toast.makeText(getContext(), String.format(getString(R.string.sent), data), 300).show();
305+
Toast.makeText(getContext(), String.format(getString(R.string.sent), data), Toast.LENGTH_LONG).show();
306306
}
307307
});
308308
Log.i(TAG, String.format("Metadata sent successfully! The content is %s", data));
@@ -320,7 +320,7 @@ public void onMetadataReceived(byte[] buffer, int uid, long timeStampMs)
320320
handler.post(new Runnable() {
321321
@Override
322322
public void run() {
323-
Toast.makeText(getContext(), String.format(getString(R.string.received), data), 300).show();
323+
Toast.makeText(getContext(), String.format(getString(R.string.received), data), Toast.LENGTH_LONG).show();
324324
}
325325
});
326326
Log.i(TAG, "onMetadataReceived:" + data);
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<!-- <string name="agora_app_id" translatable="false">YOUR APP ID</string>-->
4-
<!-- <string name="agora_access_token" translatable="false">YOUR ACCESS TOKEN</string>-->
53
<string name="agora_app_id" translatable="false">YOUR APP ID</string>
64
<string name="agora_access_token" translatable="false">YOUR ACCESS TOKEN</string>
75
</resources>

Android/APIExample/gradlew

100644100755
File mode changed.

Android/APIExample/lib-switch-external-video/src/main/java/io/agora/advancedvideo/externvideosource/ExternalVideoInputManager.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
import io.agora.api.component.gles.ProgramTextureOES;
1919
import io.agora.api.component.gles.core.EglCore;
2020
import io.agora.api.component.gles.core.GlUtil;
21+
import io.agora.rtc.gl.TextureTransformer;
2122
import io.agora.rtc.mediaio.IVideoFrameConsumer;
2223
import io.agora.rtc.mediaio.IVideoSource;
2324
import io.agora.rtc.mediaio.MediaIO;
2425

25-
import static android.media.MediaRecorder.VideoSource.CAMERA;
2626
import static io.agora.api.component.Constant.ENGINE;
2727
import static io.agora.api.component.Constant.TEXTUREVIEW;
2828
import static io.agora.rtc.mediaio.MediaIO.BufferType.TEXTURE;
@@ -67,6 +67,8 @@ public class ExternalVideoInputManager implements IVideoSource {
6767
private volatile IVideoFrameConsumer mConsumer;
6868

6969
private Context context;
70+
private TextureTransformer textureTransformer;
71+
private static final int MAX_TEXTURE_COPY = 1;
7072

7173
public ExternalVideoInputManager(Context context) {
7274
this.context = context;
@@ -85,6 +87,7 @@ boolean setExternalVideoInput(int type, Intent intent) {
8587
return false;
8688
}
8789

90+
type = TYPE_SCREEN_SHARE;
8891
IExternalVideoInput input;
8992
switch (type) {
9093
case TYPE_LOCAL_VIDEO:
@@ -221,6 +224,7 @@ private void prepare() {
221224
mThreadContext.eglCore = mEglCore;
222225
mThreadContext.context = mEglCore.getEGLContext();
223226
mThreadContext.program = new ProgramTextureOES();
227+
textureTransformer = new TextureTransformer(MAX_TEXTURE_COPY);
224228
/**Customizes the video source.
225229
* Call this method to add an external video source to the SDK.*/
226230
ENGINE.setVideoSource(ExternalVideoInputManager.this);
@@ -231,6 +235,7 @@ private void release() {
231235
return;
232236
}
233237
/**release external video source*/
238+
textureTransformer.release();
234239
ENGINE.setVideoSource(null);
235240
mSurface.release();
236241
mEglCore.makeNothingCurrent();
@@ -322,6 +327,7 @@ public void run() {
322327
* @param rotation Clockwise rotating angle (0, 90, 180, and 270 degrees) of the video frame
323328
* @param timestamp Timestamp of the video frame. For each video frame, you need to set a timestamp
324329
* @param matrix Matrix of the texture. The float value is between 0 and 1, such as 0.1, 0.2, and so on*/
330+
textureTransformer.copy(mTextureId, TEXTURE_OES.intValue(), mVideoWidth, mVideoHeight);
325331
mConsumer.consumeTextureFrame(mTextureId,
326332
TEXTURE_OES.intValue(),
327333
mVideoWidth, mVideoHeight, 0,

Android/APIExample/lib-switch-external-video/src/main/java/io/agora/advancedvideo/externvideosource/localvideo/LocalVideoInput.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.agora.advancedvideo.externvideosource.localvideo;
22

3+
import android.annotation.TargetApi;
34
import android.graphics.SurfaceTexture;
45
import android.media.MediaCodec;
56
import android.media.MediaExtractor;
@@ -121,6 +122,11 @@ private void setViewPort(int videoW, int videoH, int surfaceW, int surfaceH) {
121122

122123
@Override
123124
public Size onGetFrameSize() {
125+
return getSize();
126+
}
127+
128+
@TargetApi(21)
129+
private Size getSize(){
124130
return new Size(mVideoWidth, mVideoHeight);
125131
}
126132

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<resources>
2-
<string name="app_name">ExternVideoSource</string>
2+
<string name="app_name" translatable="false">ExternVideoSource</string>
33

44
<string name="switch_video_input_btn">Switch Input</string>
55
</resources>

0 commit comments

Comments
 (0)