pangweixin 4 роки тому
батько
коміт
0f4549f418

+ 12 - 4
VideoCall/src/main/java/com/tencent/trtc/videocall/VideoCallingActivity.java

@@ -109,6 +109,14 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
     public void playjieting() {
         //加载res/raw的happyis.mp3文件
         mMediaPlayer = MediaPlayer.create(this, R.raw.guaduan);
+        mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
+            @Override
+            public void onCompletion(MediaPlayer mp) {
+                if(mMediaPlayer!=null){
+                    finish();
+                }
+            }
+        });
         mMediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
             @Override
             public boolean onError(MediaPlayer mediaPlayer, int i, int i1) {
@@ -139,7 +147,6 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
         }
         mTRTCCloud.startLocalAudio(TRTCCloudDef.TRTC_AUDIO_QUALITY_SPEECH);
         mTRTCCloud.enterRoom(trtcParams, TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL);
-
     }
 
     @Override
@@ -150,7 +157,8 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void stopTrtcasEvent(TrtcEventT trtcEvent) {
         if (1 == trtcEvent.getCode() && "FUSHAN_TRTC_STOP".equals(trtcEvent.getTrtcType())) {
-            finish();
+            playjieting();
+
         }
     }
 
@@ -190,14 +198,14 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
     public void onClick(View v) {
         int id = v.getId();
         if (id == R.id.iv_back) {
-            finish();
+            playjieting();
         } else if (id == R.id.rl_qiehuan) {
             qiehuan();
         } else if (id == R.id.rl_maike) {
             muteAudio();
         } else if (id == R.id.rl_guaduan) {
             EventBus.getDefault().post(new TrtcEvent(2, "FUSHAN_TRTC_STOP"));
-            finish();
+            playjieting();
         }
     }
 

+ 7 - 9
VideoCall/src/main/res/layout/videocall_activity_calling.xml

@@ -11,19 +11,18 @@
         android:gravity="center"
         android:text="正在进行语音通话"
         android:textColor="#ffffff"
-        android:visibility="gone"
-        android:textSize="30sp" />
+        android:textSize="30sp"
+        android:visibility="gone" />
 
     <com.tencent.rtmp.ui.TXCloudVideoView
         android:id="@+id/trtc_view_2"
         android:layout_width="match_parent"
-        android:layout_height="match_parent">
+        android:layout_height="match_parent" />
 
-        <com.tencent.rtmp.ui.TXCloudVideoView
-            android:id="@+id/txcvv_main"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent" />
-    </com.tencent.rtmp.ui.TXCloudVideoView>
+    <com.tencent.rtmp.ui.TXCloudVideoView
+        android:id="@+id/txcvv_main"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
 
     <com.tencent.rtmp.ui.TXCloudVideoView
         android:id="@+id/trtc_view_1"
@@ -33,7 +32,6 @@
         android:layout_marginTop="30dp"
         android:layout_marginEnd="30dp" />
 
-
     <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"

+ 2 - 2
app/build.gradle

@@ -7,8 +7,8 @@ android {
         applicationId "com.qingdaofushan.home"
         minSdk 22
         targetSdk 29
-        versionCode 1
-        versionName "1.0"
+        versionCode 5
+        versionName "1.1.1"
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 

+ 3 - 0
app/src/main/AndroidManifest.xml

@@ -50,6 +50,8 @@
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
+                <category android:name="android.intent.category.HOME" />
+                <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity> <!-- <activity -->
         <!-- android:name="com.king.zxing.CaptureActivity" -->
@@ -69,6 +71,7 @@
                 android:name="android.support.FILE_PROVIDER_PATHS"
                 android:resource="@xml/file_paths" />
         </provider>
+
     </application>
 
 </manifest>

+ 29 - 3
app/src/main/java/com/qingdaofushan/home/weiview/WebViewActivity.java

@@ -17,6 +17,7 @@ import android.os.Bundle;
 import android.os.Environment;
 import android.provider.MediaStore;
 import android.util.Base64;
+import android.util.Log;
 import android.view.KeyEvent;
 import android.view.View;
 import android.webkit.ValueCallback;
@@ -106,7 +107,6 @@ public class WebViewActivity extends NfcActivity {
 
     @Override
     protected void onNfcTouch() {
-        ToastUtil.showToast("NFC TagId:" + getTagId());
         readNfc();
     }
 
@@ -115,7 +115,7 @@ public class WebViewActivity extends NfcActivity {
         mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
             @Override
             public void onCompletion(MediaPlayer mediaPlayer) {
-                if(mMediaPlayer!=null){
+                if (mMediaPlayer != null) {
                     mMediaPlayer.start();
                 }
             }
@@ -136,7 +136,7 @@ public class WebViewActivity extends NfcActivity {
         mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
             @Override
             public void onCompletion(MediaPlayer mediaPlayer) {
-                if(mMediaPlayer!=null){
+                if (mMediaPlayer != null) {
                     mMediaPlayer.start();
                 }
             }
@@ -151,6 +151,26 @@ public class WebViewActivity extends NfcActivity {
         mMediaPlayer.start();
     }
 
+    public void playguaduan() {
+        //加载res/raw的happyis.mp3文件
+        mMediaPlayer = MediaPlayer.create(this, com.tencent.trtc.videocall.R.raw.guaduan);
+        mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
+            @Override
+            public void onCompletion(MediaPlayer mp) {
+                if (mMediaPlayer != null) {
+                }
+            }
+        });
+        mMediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
+            @Override
+            public boolean onError(MediaPlayer mediaPlayer, int i, int i1) {
+                mediaPlayer.seekTo(0);
+                return false;
+            }
+        });
+        mMediaPlayer.start();
+    }
+
     public void stophujiao() {
         if (mMediaPlayer != null) {
             mMediaPlayer.stop();
@@ -163,7 +183,11 @@ public class WebViewActivity extends NfcActivity {
         try {
             //read nfc content from tag;
             s = this.readNfcContent();
+            s = s.substring(4);
+            mAgentWeb.getJsAccessEntrace().quickCallJs("FsNfc", s);
+            ToastUtil.showToast(s);
         } catch (Exception e) {
+            Log.e("pwx", e.toString() );
             ToastUtil.showToast("NFC读取失败");
         }
     }
@@ -412,6 +436,8 @@ public class WebViewActivity extends NfcActivity {
             playjieting();
         } else if (eventData.getCode() == 3) {
             stophujiao();
+        } else if (eventData.getCode() == 4) {
+            playguaduan();
         }
     }