From fa169be47a734bc1b6cde18664c266bc62b989e1 Mon Sep 17 00:00:00 2001 From: liuxiaozhong <> Date: Wed, 19 Aug 2020 12:40:55 +0800 Subject: [PATCH] update sdk --- .../sample/app/build.gradle | 8 +++++--- .../VideoActivity.java | 20 +++++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/AR-Android-Tutorial-1to1/sample/app/build.gradle b/AR-Android-Tutorial-1to1/sample/app/build.gradle index 9ce79b9..f59e2d0 100644 --- a/AR-Android-Tutorial-1to1/sample/app/build.gradle +++ b/AR-Android-Tutorial-1to1/sample/app/build.gradle @@ -8,10 +8,12 @@ android { applicationId "org.ar.ar_android_tutorial_1to1" minSdkVersion 19 targetSdkVersion 29 - versionCode 1 - versionName "1.0" + versionCode 2 + versionName "1.0.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + + } buildTypes { @@ -34,5 +36,5 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' implementation project(path: ':logger') - implementation 'org.ar:rtc:4.0.0.8' + implementation 'org.ar:rtc:4.0.1.0' } \ No newline at end of file diff --git a/AR-Android-Tutorial-1to1/sample/app/src/main/java/org/ar/ar_android_tutorial_1to1/VideoActivity.java b/AR-Android-Tutorial-1to1/sample/app/src/main/java/org/ar/ar_android_tutorial_1to1/VideoActivity.java index 5ad00bb..7b61e96 100644 --- a/AR-Android-Tutorial-1to1/sample/app/src/main/java/org/ar/ar_android_tutorial_1to1/VideoActivity.java +++ b/AR-Android-Tutorial-1to1/sample/app/src/main/java/org/ar/ar_android_tutorial_1to1/VideoActivity.java @@ -10,6 +10,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; +import android.os.Handler; import android.util.Log; import android.view.KeyEvent; import android.view.TextureView; @@ -83,6 +84,8 @@ private void initEngineAndJoinChannel() { private void initializeEngine() { try { mRtcEngine = RtcEngine.create(getBaseContext(), getResources().getString(R.string.app_id), mRtcEventHandler); + //启用视频模块 + mRtcEngine.enableVideo(); } catch (Exception e) { throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e)); } @@ -94,7 +97,7 @@ private void joinChannel() { } private void leaveChannel() { - RtcEngine.destroy(); + mRtcEngine.leaveChannel(); } @@ -161,8 +164,7 @@ public void run() { }; private void setupLocalVideo() { - //启用视频模块 - mRtcEngine.enableVideo(); + //创建TextureView对象 TextureView mLocalView = RtcEngine.CreateRendererView(getBaseContext()); if (rlLocal!=null){ @@ -199,7 +201,7 @@ private void removeLocalVideo() { } } private void startCall() { - initializeEngine(); +// initializeEngine(); setupLocalVideo(); joinChannel(); } @@ -287,8 +289,18 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_BACK){ if (!mCallEnd){ endCall(); + finish(); + return true; } + } return super.onKeyDown(keyCode, event); } + + + @Override + protected void onDestroy() { + super.onDestroy(); + RtcEngine.destroy(); + } } \ No newline at end of file