From 4468aa4094f1d94b8ef1e3b6cabd87ae0b43759f Mon Sep 17 00:00:00 2001
From: huangxinbao <huangxinbao@3mang.com>
Date: Fri, 19 May 2017 20:10:01 +0800
Subject: [PATCH] Restore the backstage playback without video

---
 MyApplication/xdy/src/main/java/com/mang/xdy/core/XdySdk.java                                      |  7 ++++---
 MyApplication/xuedianyun/src/main/java/com/mang/xuedianyun/android/activity/VideoPlayActivity.java | 14 ++++++++------
 MyApplication/xuedianyun/src/main/res/layout/activity_main.xml                                     |  2 +-
 MyApplication/xuedianyun/src/main/res/layout/activity_video_play.xml                               |  4 ++--
 release/xuedianyun201705191.apk                                                                    | Bin 38071135 -> 0 bytes
 release/xuedianyun_201705193.apk                                                                   | Bin 0 -> 38071159 bytes
 6 files changed, 15 insertions(+), 12 deletions(-)
 delete mode 100644 release/xuedianyun201705191.apk
 create mode 100644 release/xuedianyun_201705193.apk

diff --git a/MyApplication/xdy/src/main/java/com/mang/xdy/core/XdySdk.java b/MyApplication/xdy/src/main/java/com/mang/xdy/core/XdySdk.java
index a3441eb..a5a5a41 100644
--- a/MyApplication/xdy/src/main/java/com/mang/xdy/core/XdySdk.java
+++ b/MyApplication/xdy/src/main/java/com/mang/xdy/core/XdySdk.java
@@ -54,7 +54,7 @@ public  class XdySdk implements SubjectListener {
 
     public  static String TAG="xdysdk";
     /*当前播放视频的id*/
-    private String currentPlayId="";
+    private static String currentPlayId="";
     /*缓存管理*/
     private static ACache aCache;
      private  SurfaceView mSurfaceView_Publish;
@@ -371,7 +371,7 @@ public  class XdySdk implements SubjectListener {
                         mXdyPublisher.publisher(video_url,mSurfaceView_Publish, new EventHande_Publish());
 //                        PlayerUtils.setPublishSendSuccessVideo(aCache.getAsString(Constants.GET_VIDEO_PUBLISH_PATH));
                         //// TODO: 2017/4/13  大牛连接成功回调没有监听到 暂时在这告知后台,(后续加上网路判断,摄像头判断)
-                     setPublishSendSuccessVideo(video_url);
+                        setPublishSendSuccessVideo(video_url);
                     }else{
                         mMsgManage.getPublishVideoPathError();
                     }
@@ -581,6 +581,7 @@ public  class XdySdk implements SubjectListener {
         isCurrentVideoHost=false;
         isCurrentAudioHost=false;
         onPublisherStop();
+        currentPlayId="";
     }
 
     /**
@@ -675,7 +676,7 @@ public  class XdySdk implements SubjectListener {
                     break;
                 case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_STOP:
                     Log.i(TAG, "关闭。。");
-                  notifyObserver("play_stop",currentPlayId+"");
+//                  notifyObserver("play_stop",currentPlayId+"");
                     break;
                 case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_RESOLUTION_INFO:
                     Log.e(TAG, "分辨率信息: width: " + param1 + ", height: " + param2);
diff --git a/MyApplication/xuedianyun/src/main/java/com/mang/xuedianyun/android/activity/VideoPlayActivity.java b/MyApplication/xuedianyun/src/main/java/com/mang/xuedianyun/android/activity/VideoPlayActivity.java
index 4752cf4..b6c8bd4 100644
--- a/MyApplication/xuedianyun/src/main/java/com/mang/xuedianyun/android/activity/VideoPlayActivity.java
+++ b/MyApplication/xuedianyun/src/main/java/com/mang/xuedianyun/android/activity/VideoPlayActivity.java
@@ -130,7 +130,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
     private LoginDialog mLoginDialog;
     private ProgressDialog mProgressDialog;
 
-    private String playVideoOrAudioId = "";
+    private  String playVideoOrAudioId = "";
     //播放视频模式还是音频模式
     private boolean isPlayVideoMode = true;
     /*推流视频模式还是音频模式*/
@@ -189,7 +189,6 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
                         seek = jsonObject.optLong("recordPlaybackMaxTime");
                         className = jsonObject.optString("className");
                         classType = jsonObject.optInt("classType");
-                        XdyLogUtil.i("课堂类型", "" + classType);
 
                     } catch (JSONException e) {
                         e.printStackTrace();
@@ -224,7 +223,6 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
                     //停止播放
                 case Constants.AUDIO_STOP:
                     //停止播放
-                    playVideoOrAudioId = "";
                     stopPlay(responseEntity.getParam());
                     break;
                 case Constants.PLAY_SUCCESS:
@@ -516,7 +514,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
 //            if (!checkPermissionVideo()) {
 //                return;
 //            }
-
+             playVideoOrAudioId=response;
             DisplayMetrics dm = new DisplayMetrics();
             getWindowManager().getDefaultDisplay().getMetrics(dm);
             int widthPixels = dm.widthPixels;
@@ -550,12 +548,13 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
 //                XdyLogUtil.e("surface 设置后的高度的高度计算:", surfaceviewPlayVideo.getWidth() + "高:" + surfaceviewPlayVideo.getHeight());
 //
 //            }
-            xdySdk.api("playVideo", response + "", surfaceviewPlayVideo, VideoPlayActivity.this);
+            xdySdk.api(Constants.PLAY_VIDEO, response + "", surfaceviewPlayVideo, VideoPlayActivity.this);
 //        img_playVideo_novideo.setVisibility(View.GONE);
             if(isTablet(this)) {
                 setTabletTeacherCover(true,false);
             }else {
                 img_playVideo_novideo.setImageResource(R.mipmap.no_video);
+//                img_playVideo_novideo.setVisibility(View.GONE);
             }
             //// TODO: 2017/5/18  tihsi
 //            ToastUtil.showToastshort(getResources().getString(R.string.home_msg_play_video_init), VideoPlayActivity.this);
@@ -730,6 +729,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
     protected void onPause() {
         super.onPause();
         xdySdk.onPlayStop(playVideoOrAudioId);
+//        xdySdk.onPlayDestroy();
         if (isPlayVideoMode) {
             stopVideo();
         } else {
@@ -744,6 +744,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
     @Override
     protected void onResume() {
         super.onResume();
+        XdyLogUtil.e("cuowu",""+isPlayVideoMode+playVideoOrAudioId);
         if (isPlayVideoMode) {
             if (!TextUtils.isEmpty(playVideoOrAudioId))
                 playVideo(playVideoOrAudioId);
@@ -778,7 +779,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
         if (!replay) {
             xdySdk.removeAll();
         }
-
+//        playVideoOrAudioId="";
         mmHandler.removeCallbacksAndMessages(null);
         mHandler.removeCallbacksAndMessages(null);
         this.finish();
@@ -828,6 +829,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
             VideoOrAudioStopEntity entity = JsonUtil.parseJsonToBean(response, VideoOrAudioStopEntity.class);
             if (entity != null) {
                 if (xdySdk.onPlayStop(entity.getMediaId() + "")) {
+                    playVideoOrAudioId = "";
                     if(isTablet(this)){
                         setTabletTeacherCover(true,false);
                     }else {
diff --git a/MyApplication/xuedianyun/src/main/res/layout/activity_main.xml b/MyApplication/xuedianyun/src/main/res/layout/activity_main.xml
index b8a4e70..d8127ab 100644
--- a/MyApplication/xuedianyun/src/main/res/layout/activity_main.xml
+++ b/MyApplication/xuedianyun/src/main/res/layout/activity_main.xml
@@ -44,7 +44,7 @@
         style="@style/home_input_edit_style"
         android:hint="classId"
         android:inputType="number"
-        android:text="700798979"/>
+        android:text="1823431320"/>
 
     <View
         style="@style/ui_divider_line_horizontal"
diff --git a/MyApplication/xuedianyun/src/main/res/layout/activity_video_play.xml b/MyApplication/xuedianyun/src/main/res/layout/activity_video_play.xml
index 695462a..0a64c24 100644
--- a/MyApplication/xuedianyun/src/main/res/layout/activity_video_play.xml
+++ b/MyApplication/xuedianyun/src/main/res/layout/activity_video_play.xml
@@ -23,8 +23,8 @@
          />
             <ImageView
                 android:id="@+id/img_playVideo_novideo"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
+                android:layout_width="20dp"
+                android:layout_height="20dp"
                 android:scaleType="fitXY"
                 android:background="@mipmap/no_video"
                 />
diff --git a/release/xuedianyun201705191.apk b/release/xuedianyun201705191.apk
deleted file mode 100644
index de3a76a..0000000
Binary files a/release/xuedianyun201705191.apk and /dev/null differ
diff --git a/release/xuedianyun_201705193.apk b/release/xuedianyun_201705193.apk
new file mode 100644
index 0000000..eee94c6
Binary files /dev/null and b/release/xuedianyun_201705193.apk differ
--
libgit2 0.24.0