huangxinbao

Modify push video will play their own problems

1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4"> 2 <project version="4">
3 - <component name="EntryPointsManager">  
4 - <entry_points version="2.0" />  
5 - </component>  
6 - <component name="NullableNotNullManager">  
7 - <option name="myDefaultNullable" value="android.support.annotation.Nullable" />  
8 - <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />  
9 - <option name="myNullables">  
10 - <value>  
11 - <list size="4">  
12 - <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />  
13 - <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />  
14 - <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />  
15 - <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />  
16 - </list>  
17 - </value>  
18 - </option>  
19 - <option name="myNotNulls">  
20 - <value>  
21 - <list size="4">  
22 - <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />  
23 - <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />  
24 - <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />  
25 - <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />  
26 - </list>  
27 - </value>  
28 - </option>  
29 - </component>  
30 <component name="ProjectLevelVcsManager" settingsEditedManually="false"> 3 <component name="ProjectLevelVcsManager" settingsEditedManually="false">
31 <OptionsSetting value="true" id="Add" /> 4 <OptionsSetting value="true" id="Add" />
32 <OptionsSetting value="true" id="Remove" /> 5 <OptionsSetting value="true" id="Remove" />
@@ -10,7 +10,6 @@ android { @@ -10,7 +10,6 @@ android {
10 targetSdkVersion 22 10 targetSdkVersion 22
11 versionCode 1 11 versionCode 1
12 versionName "1.0" 12 versionName "1.0"
13 -  
14 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 14
16 } 15 }
@@ -11,10 +11,8 @@ import android.widget.EditText; @@ -11,10 +11,8 @@ import android.widget.EditText;
11 import com.google.gson.Gson; 11 import com.google.gson.Gson;
12 12
13 import com.mang.xdy.demo.activity.VideoPlayActivity; 13 import com.mang.xdy.demo.activity.VideoPlayActivity;
14 -import com.mang.xdy.demo.bean.JoinClass;  
15 import com.mang.xdy.demo.bean.JoinClassBean; 14 import com.mang.xdy.demo.bean.JoinClassBean;
16 import com.mang.xdy.demo.utils.ToastUtil; 15 import com.mang.xdy.demo.utils.ToastUtil;
17 -import com.mang.xdy.utils.XdyLogUtil;  
18 16
19 import java.util.ArrayList; 17 import java.util.ArrayList;
20 18
@@ -36,8 +34,6 @@ public class MainActivity extends AppCompatActivity { @@ -36,8 +34,6 @@ public class MainActivity extends AppCompatActivity {
36 Button btnHomeEnterClass; 34 Button btnHomeEnterClass;
37 @BindView(R.id.btn_home_enter_publisher) 35 @BindView(R.id.btn_home_enter_publisher)
38 Button btn_home_enter_publisher; 36 Button btn_home_enter_publisher;
39 - @BindView(R.id.btn_home_enter_publisherAudio)  
40 - Button btn_home_enter_publisherAudio;  
41 /*一进来就要初始化,让后再调 加入课堂*/ 37 /*一进来就要初始化,让后再调 加入课堂*/
42 @Override 38 @Override
43 protected void onCreate(Bundle savedInstanceState) { 39 protected void onCreate(Bundle savedInstanceState) {
@@ -46,7 +42,7 @@ public class MainActivity extends AppCompatActivity { @@ -46,7 +42,7 @@ public class MainActivity extends AppCompatActivity {
46 ButterKnife.bind(this); 42 ButterKnife.bind(this);
47 } 43 }
48 44
49 - @OnClick({R.id.btn_home_enter_class,R.id.btn_home_enter_publisher,R.id.btn_home_enter_publisherAudio}) 45 + @OnClick({R.id.btn_home_enter_class,R.id.btn_home_enter_publisher})
50 public void onViewClicked(View view) { 46 public void onViewClicked(View view) {
51 if(TextUtils.isEmpty(joinClass())){ 47 if(TextUtils.isEmpty(joinClass())){
52 return; 48 return;
@@ -70,11 +66,6 @@ public class MainActivity extends AppCompatActivity { @@ -70,11 +66,6 @@ public class MainActivity extends AppCompatActivity {
70 intents.putStringArrayListExtra("init",arrayList); 66 intents.putStringArrayListExtra("init",arrayList);
71 startActivity(intents); 67 startActivity(intents);
72 break; 68 break;
73 - case R.id.btn_home_enter_publisherAudio:  
74 -// Intent intent_audio=new Intent(MainActivity.this, AudioPublisherActivity.class);  
75 -// intent_audio.putExtra("init",joinClass());  
76 -// startActivity(intent_audio);  
77 - break;  
78 } 69 }
79 } 70 }
80 private String classId=""; 71 private String classId="";
1 package com.mang.xdy.demo.activity; 1 package com.mang.xdy.demo.activity;
2 ; 2 ;
  3 +import android.Manifest;
3 import android.annotation.SuppressLint; 4 import android.annotation.SuppressLint;
4 import android.app.ProgressDialog; 5 import android.app.ProgressDialog;
5 -import android.app.Service;  
6 -import android.content.Context;  
7 import android.content.DialogInterface; 6 import android.content.DialogInterface;
8 -import android.graphics.PixelFormat;  
9 -import android.hardware.display.VirtualDisplay;  
10 -import android.media.projection.MediaProjection;  
11 -import android.media.projection.MediaProjectionManager; 7 +import android.content.pm.PackageManager;
12 import android.os.Bundle; 8 import android.os.Bundle;
13 import android.os.Handler; 9 import android.os.Handler;
14 import android.os.Message; 10 import android.os.Message;
15 import android.support.design.widget.TabLayout; 11 import android.support.design.widget.TabLayout;
  12 +import android.support.v4.app.ActivityCompat;
  13 +import android.support.v4.content.PermissionChecker;
16 import android.support.v7.app.AlertDialog; 14 import android.support.v7.app.AlertDialog;
17 import android.support.v7.app.AppCompatActivity; 15 import android.support.v7.app.AppCompatActivity;
18 import android.text.TextUtils; 16 import android.text.TextUtils;
19 -import android.util.DisplayMetrics;  
20 import android.util.Log; 17 import android.util.Log;
21 -import android.view.Gravity;  
22 import android.view.SurfaceHolder; 18 import android.view.SurfaceHolder;
23 import android.view.SurfaceView; 19 import android.view.SurfaceView;
24 import android.view.View; 20 import android.view.View;
25 -import android.view.ViewGroup;  
26 import android.view.WindowManager; 21 import android.view.WindowManager;
27 -import android.widget.Button;  
28 import android.widget.FrameLayout; 22 import android.widget.FrameLayout;
29 import android.widget.ImageButton; 23 import android.widget.ImageButton;
30 import android.widget.ImageView; 24 import android.widget.ImageView;
31 import android.widget.RelativeLayout; 25 import android.widget.RelativeLayout;
32 import android.widget.SeekBar; 26 import android.widget.SeekBar;
33 import android.widget.TextView; 27 import android.widget.TextView;
  28 +import android.widget.Toast;
34 29
35 import com.google.gson.Gson; 30 import com.google.gson.Gson;
36 import com.mang.xdy.bean.VideoPlayBean; 31 import com.mang.xdy.bean.VideoPlayBean;
@@ -58,9 +53,6 @@ import com.pili.pldroid.player.AVOptions; @@ -58,9 +53,6 @@ import com.pili.pldroid.player.AVOptions;
58 import com.pili.pldroid.player.PLMediaPlayer; 53 import com.pili.pldroid.player.PLMediaPlayer;
59 import com.pili.pldroid.player.widget.PLVideoTextureView; 54 import com.pili.pldroid.player.widget.PLVideoTextureView;
60 import com.pili.pldroid.player.widget.PLVideoView; 55 import com.pili.pldroid.player.widget.PLVideoView;
61 -import com.videoengine.NTRenderer;  
62 -  
63 -  
64 import org.greenrobot.eventbus.EventBus; 56 import org.greenrobot.eventbus.EventBus;
65 import org.json.JSONException; 57 import org.json.JSONException;
66 import org.json.JSONObject; 58 import org.json.JSONObject;
@@ -77,8 +69,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -77,8 +69,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
77 private final static String TAG = "VideoPlayActivity"; 69 private final static String TAG = "VideoPlayActivity";
78 @BindView(R.id.img_playVideo_novideo) 70 @BindView(R.id.img_playVideo_novideo)
79 ImageView img_playVideo_novideo; 71 ImageView img_playVideo_novideo;
80 - @BindView(R.id.btn_videoPlay_exit)  
81 - Button btn_videoPlay_exit; 72 + @BindView(R.id.img_videoPlay_start)
  73 + ImageView img_videoPlay_start;
82 private String username = ""; 74 private String username = "";
83 private String userpwd = ""; 75 private String userpwd = "";
84 private SimpleFragmentPagerAdapter pagerAdapter; 76 private SimpleFragmentPagerAdapter pagerAdapter;
@@ -87,15 +79,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -87,15 +79,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
87 private TabLayout tabLayout; 79 private TabLayout tabLayout;
88 @BindView(R.id.surfaceview_playVideo) 80 @BindView(R.id.surfaceview_playVideo)
89 SurfaceView surfaceviewPlayVideo; 81 SurfaceView surfaceviewPlayVideo;
90 -  
91 - @BindView(R.id.fra_videoPlay_publish)  
92 - FrameLayout frameLayout_publish;  
93 -  
94 - @BindView(R.id.btn_videoPlay_stopPublish)  
95 - Button btn_videoPlay_stopPublish;  
96 - /*推流*/  
97 -// @BindView(R.id.surfaceview_playVideo_text)  
98 - SurfaceView mSurfaceView ; 82 + @BindView(R.id.img_videoPlay_stopPublish)
  83 + ImageView btn_videoPlay_stopPublish;
  84 + @BindView(R.id.sur_plaVideo_publish)
  85 + SurfaceView surfaceView_publish;
99 private String initClass = ""; 86 private String initClass = "";
100 private XdySdk xdySdk; 87 private XdySdk xdySdk;
101 private LoginDialog mLoginDialog; 88 private LoginDialog mLoginDialog;
@@ -108,17 +95,22 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -108,17 +95,22 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
108 /*mcu断开或者网络原因为false*/ 95 /*mcu断开或者网络原因为false*/
109 private boolean isDefaultExit=true; 96 private boolean isDefaultExit=true;
110 private AlertDialog mErrorDialog; 97 private AlertDialog mErrorDialog;
111 -  
112 private ACache aCache; 98 private ACache aCache;
113 - //TODO 默认回放 99 + //是否是回放状态,
114 private boolean replay = false; 100 private boolean replay = false;
  101 + SurfaceHolder sh;
  102 + @BindView(R.id.img_videoPlay_back)
  103 + ImageView mImageView_Back;
  104 + @BindView(R.id.tv_videoPlay_className)
  105 + TextView mTextView_ClassName;
  106 + /*课堂名字*/
  107 + private String className;
115 private Handler mmHandler = new Handler() { 108 private Handler mmHandler = new Handler() {
116 @Override 109 @Override
117 public void handleMessage(Message msg) { 110 public void handleMessage(Message msg) {
118 super.handleMessage(msg); 111 super.handleMessage(msg);
119 ResponseEntity responseEntity = (ResponseEntity) msg.obj; 112 ResponseEntity responseEntity = (ResponseEntity) msg.obj;
120 switch (responseEntity.getType()) { 113 switch (responseEntity.getType()) {
121 -  
122 case Constants.CLASS_EXIT: 114 case Constants.CLASS_EXIT:
123 ToastUtil.showToast("退出课堂",VideoPlayActivity.this); 115 ToastUtil.showToast("退出课堂",VideoPlayActivity.this);
124 progressDialogDismiss(); 116 progressDialogDismiss();
@@ -139,16 +131,22 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -139,16 +131,22 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
139 ToastUtil.showToastshort("加入课堂成功", VideoPlayActivity.this); 131 ToastUtil.showToastshort("加入课堂成功", VideoPlayActivity.this);
140 String userJson = responseEntity.getParam(); 132 String userJson = responseEntity.getParam();
141 SPUtil.putString(VideoPlayActivity.this, Constants.CLASS_JOIN_SUCCESS, userJson); 133 SPUtil.putString(VideoPlayActivity.this, Constants.CLASS_JOIN_SUCCESS, userJson);
142 -// JSONObject jsonObject = null;  
143 -// try {  
144 -// jsonObject = new JSONObject(userJson);  
145 -// replay = jsonObject.optBoolean("isRecordPlayBack");  
146 -// } catch (JSONException e) {  
147 -// e.printStackTrace();  
148 -// } 134 + JSONObject jsonObject = null;
  135 +
  136 + try {
  137 + jsonObject = new JSONObject(userJson);
  138 + seek = jsonObject.optLong("recordPlaybackMaxTime");
  139 + className=jsonObject.optString("className");
  140 + } catch (JSONException e) {
  141 + e.printStackTrace();
  142 + }
  143 + if(!TextUtils.isEmpty(className)){
  144 + mTextView_ClassName.setText(className);
  145 + }
149 if(replay) { 146 if(replay) {
150 initRecordSeek(userJson); 147 initRecordSeek(userJson);
151 } 148 }
  149 +
152 break; 150 break;
153 case Constants.VIDEO_PLAY: 151 case Constants.VIDEO_PLAY:
154 //播放视频 152 //播放视频
@@ -192,7 +190,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -192,7 +190,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
192 setContentView(R.layout.activity_video_play); 190 setContentView(R.layout.activity_video_play);
193 ButterKnife.bind(this); 191 ButterKnife.bind(this);
194 aCache=ACache.get(this); 192 aCache=ACache.get(this);
195 -// XdySdk.init(this);  
196 xdySdk = XdySdk.getXdyInstance(); 193 xdySdk = XdySdk.getXdyInstance();
197 xdySdk.add(this); 194 xdySdk.add(this);
198 init(); 195 init();
@@ -215,76 +212,50 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -215,76 +212,50 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
215 if(!replay){ 212 if(!replay){
216 mVideoView.setVisibility(View.GONE); 213 mVideoView.setVisibility(View.GONE);
217 mMediaContainer.setVisibility(View.GONE); 214 mMediaContainer.setVisibility(View.GONE);
218 -// btn_videoPlay_exit.setVisibility(View.VISIBLE); 215 + img_videoPlay_start.setVisibility(View.VISIBLE);
  216 +// btn_videoPlay_stopPublish.setVisibility(View.VISIBLE);
219 }else{ 217 }else{
220 surfaceviewPlayVideo.setVisibility(View.GONE); 218 surfaceviewPlayVideo.setVisibility(View.GONE);
221 initReplay(); 219 initReplay();
222 220
223 } 221 }
224 -// initClass = getIntent().getStringExtra("init");  
225 if(!replay){ 222 if(!replay){
226 xdySdk.api("init", initClass); 223 xdySdk.api("init", initClass);
227 }else{ 224 }else{
228 xdySdk.api("initRecordPlayback", initClass); 225 xdySdk.api("initRecordPlayback", initClass);
229 -// xdySdk.api("startRecordPlayback", "");  
230 } 226 }
231 currentTime=0; 227 currentTime=0;
232 btn_videoPlay_stopPublish.setOnClickListener(new View.OnClickListener() { 228 btn_videoPlay_stopPublish.setOnClickListener(new View.OnClickListener() {
233 @Override 229 @Override
234 public void onClick(View v) { 230 public void onClick(View v) {
235 xdySdk.api("stopPublishVideo", ""); 231 xdySdk.api("stopPublishVideo", "");
  232 + img_videoPlay_start.setEnabled(true);
  233 + btn_videoPlay_stopPublish.setEnabled(false);
  234 + btn_videoPlay_stopPublish.setVisibility(View.GONE);
  235 + img_videoPlay_start.setVisibility(View.VISIBLE);
  236 + surfaceView_publish.setVisibility(View.GONE);
236 } 237 }
237 }); 238 });
238 - btn_videoPlay_exit.setOnClickListener(new View.OnClickListener() { 239 +
  240 + img_videoPlay_start.setOnClickListener(new View.OnClickListener() {
239 @Override 241 @Override
240 public void onClick(View v) { 242 public void onClick(View v) {
241 - if (mSurfaceView == null) {  
242 - mSurfaceView = NTRenderer.CreateRenderer(VideoPlayActivity.this, false);  
243 - }  
244 btn_videoPlay_stopPublish.setVisibility(View.VISIBLE); 243 btn_videoPlay_stopPublish.setVisibility(View.VISIBLE);
245 - btn_videoPlay_exit.setVisibility(View.GONE);  
246 - btn_videoPlay_exit.setEnabled(false);  
247 -// mSurfaceView=new SurfaceView(VideoPlayActivity.this);  
248 - SurfaceHolder sh = mSurfaceView.getHolder();;  
249 - sh.setFormat(PixelFormat.TRANSPARENT);  
250 - mSurfaceView.setZOrderOnTop(true);  
251 - frameLayout_publish.addView(mSurfaceView);  
252 - xdySdk.api("publishVideo", "", mSurfaceView, VideoPlayActivity.this); 244 + img_videoPlay_start.setVisibility(View.GONE);
  245 + surfaceView_publish.setVisibility(View.VISIBLE);
  246 + img_videoPlay_start.setEnabled(false);
  247 + btn_videoPlay_stopPublish.setEnabled(true);
  248 + sh = surfaceView_publish.getHolder();
  249 + surfaceView_publish.setZOrderMediaOverlay(true);
  250 + xdySdk.api("publishVideo", "", surfaceView_publish, VideoPlayActivity.this);
253 isVideoMode=true; 251 isVideoMode=true;
254 252
255 -  
256 -// mmHandler.post(new Runnable() {  
257 -// @Override  
258 -// public void run() {  
259 -// initSmall();  
260 -// }  
261 -// });  
262 -  
263 -// xdySdk.api("leaveClass", "");  
264 -  
265 -//  
266 -// xdySdk.remove(VideoPlayActivity.this);  
267 -// xdySdk.removeAll();  
268 -// UIUtils.closeDialog(mLoginDialog);  
269 -// VideoPlayActivity.super.onBackPressed();  
270 -// exit();  
271 -// String id="initRecordPlayback";  
272 -// String param="{\n" +  
273 -// " \"classId\": 391813551,\n" +  
274 -// " \"portal\": \"112.126.80.182:90\",\n" +  
275 -// " \"userRole\": \"normal\",\n" +  
276 -// " \"userName\": \"\",\n" +  
277 -// " \"userId\": 0\n" +  
278 -// "}";  
279 -// String ss=XdyStringUtils.stringToJson(param,true);  
280 -// xdySdk.api(id,ss);  
281 -// mHandler.postDelayed(new Runnable() {  
282 -// @Override  
283 -// public void run() {  
284 -// xdySdk.api("startRecordPlayback", "");  
285 -// }  
286 -// }, 200);  
287 - 253 + }
  254 + });
  255 + mImageView_Back.setOnClickListener(new View.OnClickListener() {
  256 + @Override
  257 + public void onClick(View v) {
  258 + exit_dialog();
288 } 259 }
289 }); 260 });
290 } 261 }
@@ -294,7 +265,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -294,7 +265,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
294 viewPager.setAdapter(pagerAdapter); 265 viewPager.setAdapter(pagerAdapter);
295 viewPager.setOnRplayTouchListener(this); 266 viewPager.setOnRplayTouchListener(this);
296 tabLayout = (TabLayout) findViewById(R.id.sliding_tabs); 267 tabLayout = (TabLayout) findViewById(R.id.sliding_tabs);
297 -// tabLayout.setupWithViewPager(viewPager);  
298 tabLayout.setupWithViewPager(viewPager,false); 268 tabLayout.setupWithViewPager(viewPager,false);
299 tabLayout.setTabMode(TabLayout.MODE_FIXED); 269 tabLayout.setTabMode(TabLayout.MODE_FIXED);
300 } 270 }
@@ -330,23 +300,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -330,23 +300,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
330 } 300 }
331 301
332 //加入课堂 302 //加入课堂
333 - public void joinClass(String rsponse, boolean isShowPwd) {  
334 - JoinClass joinClass = new JoinClass();  
335 - joinClass.setHasCamera(false);  
336 - joinClass.setHasMicrophone(false);  
337 - joinClass.setUserName(username);  
338 - if (!isShowPwd) {  
339 - joinClass.setPassword("123321");  
340 - } else {  
341 - joinClass.setPassword(userpwd);  
342 - }  
343 - String temp = new Gson().toJson(joinClass);  
344 - String jsonParmp = XdyStringUtils.stringToJson(temp, true);  
345 - XdyLogUtil.e("加入课堂", jsonParmp);  
346 - xdySdk.api("joinClass", jsonParmp);  
347 - }  
348 -  
349 - //加入课堂  
350 public void joinClass(String username, String userpwd, boolean isShowPwd) { 303 public void joinClass(String username, String userpwd, boolean isShowPwd) {
351 JoinClass joinClass = new JoinClass(); 304 JoinClass joinClass = new JoinClass();
352 joinClass.setHasCamera(false); 305 joinClass.setHasCamera(false);
@@ -369,12 +322,16 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -369,12 +322,16 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
369 * @param response 322 * @param response
370 */ 323 */
371 public void playVideo(String response) { 324 public void playVideo(String response) {
  325 +
372 progressDialogDismiss(); 326 progressDialogDismiss();
373 327
374 if(replay){ 328 if(replay){
375 playRecord(response); 329 playRecord(response);
376 330
377 }else { 331 }else {
  332 + if(!checkPermission()){
  333 + return;
  334 + }
378 xdySdk.api("playVideo", response + "", surfaceviewPlayVideo, VideoPlayActivity.this); 335 xdySdk.api("playVideo", response + "", surfaceviewPlayVideo, VideoPlayActivity.this);
379 // img_playVideo_novideo.setVisibility(View.GONE); 336 // img_playVideo_novideo.setVisibility(View.GONE);
380 img_playVideo_novideo.setImageResource(R.mipmap.no_video); 337 img_playVideo_novideo.setImageResource(R.mipmap.no_video);
@@ -387,11 +344,15 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -387,11 +344,15 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
387 * @param response 344 * @param response
388 */ 345 */
389 public void playAudio(String response) { 346 public void playAudio(String response) {
  347 +
390 if(replay){ 348 if(replay){
391 playRecord(response); 349 playRecord(response);
392 img_playVideo_novideo.setImageResource(R.mipmap.audio_mode); 350 img_playVideo_novideo.setImageResource(R.mipmap.audio_mode);
393 img_playVideo_novideo.setVisibility(View.VISIBLE); 351 img_playVideo_novideo.setVisibility(View.VISIBLE);
394 }else { 352 }else {
  353 + if(!checkPermission()){
  354 + return;
  355 + }
395 xdySdk.api("playAudio", response, null, VideoPlayActivity.this); 356 xdySdk.api("playAudio", response, null, VideoPlayActivity.this);
396 img_playVideo_novideo.setImageResource(R.mipmap.audio_mode); 357 img_playVideo_novideo.setImageResource(R.mipmap.audio_mode);
397 img_playVideo_novideo.setVisibility(View.VISIBLE); 358 img_playVideo_novideo.setVisibility(View.VISIBLE);
@@ -401,6 +362,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -401,6 +362,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
401 362
402 @Override 363 @Override
403 public void onBackPressed() { 364 public void onBackPressed() {
  365 + exit_dialog();
  366 + }
  367 +
  368 + public void exit_dialog(){
404 final AlertDialog alertDialog = new AlertDialog.Builder(this) 369 final AlertDialog alertDialog = new AlertDialog.Builder(this)
405 .setTitle("退出") 370 .setTitle("退出")
406 .setMessage("是否离开课堂") 371 .setMessage("是否离开课堂")
@@ -418,13 +383,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -418,13 +383,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
418 //如果收到class_exit 就执行,退出界面 383 //如果收到class_exit 就执行,退出界面
419 UIUtils.closeDialog(mLoginDialog); 384 UIUtils.closeDialog(mLoginDialog);
420 exit(); 385 exit();
421 -// progressDialogShow();  
422 } 386 }
423 }) 387 })
424 .create(); 388 .create();
425 alertDialog.show(); 389 alertDialog.show();
426 -  
427 -  
428 } 390 }
429 391
430 /** 392 /**
@@ -488,7 +450,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -488,7 +450,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
488 }else{ 450 }else{
489 stopAudio(); 451 stopAudio();
490 } 452 }
491 - xdySdk.api("pauseRecordPlayback",""); 453 + if(replay) {
  454 + xdySdk.api("pauseRecordPlayback", "");
  455 + }
  456 +// xdySdk.onPublisherPause();
492 } 457 }
493 458
494 @Override 459 @Override
@@ -499,7 +464,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -499,7 +464,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
499 } else { 464 } else {
500 playAudio(playVideoOrAudioId); 465 playAudio(playVideoOrAudioId);
501 } 466 }
502 - xdySdk.api("startRecordPlayback",""); 467 + if(replay) {
  468 + xdySdk.api("startRecordPlayback", "");
  469 + }
  470 +// xdySdk.onPublisherResume();
503 } 471 }
504 472
505 /** 473 /**
@@ -584,6 +552,38 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -584,6 +552,38 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
584 mErrorDialog.show(); 552 mErrorDialog.show();
585 553
586 } 554 }
  555 + private boolean isCameraCheckFirst=true;
  556 + private boolean isAudioCheckFirst=true;
  557 + private boolean checkPermission() {
  558 +// try {
  559 +// int pRecordAudio = PermissionChecker.checkCallingOrSelfPermission(this, "android.permission.RECORD_AUDIO");
  560 +// int pCamera = PermissionChecker.checkCallingOrSelfPermission(this, "android.permission.CAMERA");
  561 +// if(pRecordAudio != PackageManager.PERMISSION_GRANTED) {
  562 +// Log.e(TAG,"do not have AudioRecord permission, please check");
  563 +// Toast.makeText(this,"do not have AudioRecord permission, please check", Toast.LENGTH_LONG).show();
  564 +// if(isCameraCheckFirst){
  565 +// //settingPermission();
  566 +// isCameraCheckFirst=false;
  567 +// }
  568 +// ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA},
  569 +// 1);
  570 +// return false;
  571 +// }
  572 +// if(pCamera != PackageManager.PERMISSION_GRANTED) {
  573 +// Log.e(TAG,"do not have CAMERA permission, please check");
  574 +// Toast.makeText(this,"do not have CAMERA permission, please check", Toast.LENGTH_LONG).show();
  575 +// if(isAudioCheckFirst){
  576 +// //settingPermission();
  577 +// isAudioCheckFirst=false;
  578 +// }
  579 +// return false;
  580 +//
  581 +// }
  582 +// } catch (Exception e) {
  583 +// e.printStackTrace();
  584 +// }
  585 + return true;
  586 + }
587 @Override 587 @Override
588 public void observerUpData(String type, String parameter) { 588 public void observerUpData(String type, String parameter) {
589 XdyLogUtil.e(TAG + "observer:", Thread.currentThread().getId() + "type:"+type); 589 XdyLogUtil.e(TAG + "observer:", Thread.currentThread().getId() + "type:"+type);
@@ -594,97 +594,19 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -594,97 +594,19 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
594 } 594 }
595 595
596 596
597 - /******************************悬浮********************************/  
598 - /**  
599 - * 窗口管理者  
600 - */  
601 - private WindowManager mWindowManager;  
602 -  
603 - // desk capture  
604 - private int mScreenDensity;  
605 - private int sreenWindowWidth;  
606 - private int screenWindowHeight;  
607 - private VirtualDisplay mVirtualDisplay;  
608 - private MediaProjectionManager mMediaProjectionManager;  
609 - private MediaProjection mMediaProjection;  
610 - private SurfaceView bgSurfaceView;  
611 - @SuppressWarnings("deprecation")  
612 - @SuppressLint("NewApi")  
613 - private void createScreenEnvironment() {  
614 - sreenWindowWidth = mWindowManager.getDefaultDisplay().getWidth();  
615 - screenWindowHeight = mWindowManager.getDefaultDisplay().getHeight();  
616 -  
617 -// if (sreenWindowWidth > 800) {  
618 -// if (screenResolution == SCREEN_RESOLUTION_STANDARD) {  
619 -// sreenWindowWidth = align(sreenWindowWidth / 2, 16);  
620 -// screenWindowHeight = align(screenWindowHeight / 2, 16);  
621 -// } else {  
622 -// sreenWindowWidth = align(sreenWindowWidth * 2 / 5, 16);  
623 -// screenWindowHeight = align(screenWindowHeight * 2 / 5, 16);  
624 -// }  
625 -// }  
626 -  
627 - Log.i(TAG, "mWindowWidth : " + sreenWindowWidth + ",mWindowHeight : "  
628 - + screenWindowHeight);  
629 - DisplayMetrics displayMetrics = new DisplayMetrics();  
630 - mWindowManager.getDefaultDisplay().getMetrics(displayMetrics);  
631 - mScreenDensity = displayMetrics.densityDpi;  
632 -// densityDpi mImageReader = ImageReader.newInstance(sreenWindowWidth,  
633 -// screenWindowHeight, 0x1, 2);  
634 -  
635 - mMediaProjectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE);  
636 - }  
637 - public void initSmall(){  
638 -  
639 - mWindowManager = (WindowManager) getSystemService(Service.WINDOW_SERVICE);  
640 -  
641 -// if (pushType == PUSH_TYPE_CAMERA) {  
642 -// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK  
643 -// | Intent.FLAG_ACTIVITY_SINGLE_TOP);  
644 -// PendingIntent contentIntent = PendingIntent.getActivity(this,  
645 -// 0, intent, 0);  
646 -//  
647 -// Intent bIntent = new Intent(this, BackgroudService.class);  
648 -// PendingIntent deleteIntent = PendingIntentnt.getService(this, 0,  
649 -// bIntent, 0);  
650 -//  
651 -//// notification = new Notification.Builder(this)  
652 -//// .setContentTitle("后台采集中。。").setAutoCancel(true)  
653 -//// .setDeleteIntent(deleteIntent)  
654 -//// .setContentIntent(contentIntent).build();  
655 -//  
656 -//// startForeground(android.os.Process.myPid(), notification);  
657 -  
658 - bgSurfaceView = new SurfaceView(this);  
659 - bgSurfaceView.setZOrderMediaOverlay(true);  
660 - WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(  
661 - 1, 1, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,  
662 - WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,  
663 - PixelFormat.TRANSLUCENT);  
664 - layoutParams.gravity = Gravity.LEFT | Gravity.BOTTOM;  
665 -  
666 - ImageView initPic = new ImageView(VideoPlayActivity.this);  
667 - initPic.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));  
668 - initPic.setScaleType(ImageView.ScaleType.CENTER_CROP);  
669 - initPic.setImageResource(R.mipmap.no_video);  
670 - mWindowManager.addView(bgSurfaceView, layoutParams);  
671 -// xdySdk.api("publishVideo", "", bgSurfaceView, VideoPlayActivity.this);  
672 -  
673 -// bgSurfaceView.getHolder().addCallback(this);  
674 -  
675 -  
676 - }  
677 -  
678 -  
679 /*************************************** 回放***************************************************/ 597 /*************************************** 回放***************************************************/
680 private static final int FADE_OUT = 1; 598 private static final int FADE_OUT = 1;
681 private static final int SHOW_PROGRESS = 2; 599 private static final int SHOW_PROGRESS = 2;
682 private boolean mShowing; 600 private boolean mShowing;
683 private boolean mDragging; 601 private boolean mDragging;
684 private RelativeLayout mMediaControllerRight; 602 private RelativeLayout mMediaControllerRight;
685 -// @BindView(R.id.iv_operation_video)  
686 -// ImageView operationIcon;  
687 - // private PLMediaPlayer mMediaPlayer; 603 +
  604 + private boolean pause=true;
  605 + /**
  606 + * 退出标记
  607 + */
  608 + private boolean quit;
  609 + private boolean isOver;
688 @BindView(R.id.fl_media) 610 @BindView(R.id.fl_media)
689 FrameLayout mMediaContainer; 611 FrameLayout mMediaContainer;
690 @BindView(R.id.iv_operation_play) 612 @BindView(R.id.iv_operation_play)
@@ -788,11 +710,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -788,11 +710,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
788 710
789 @Override 711 @Override
790 public boolean onInfo(PLMediaPlayer plMediaPlayer, int i, int i1) { 712 public boolean onInfo(PLMediaPlayer plMediaPlayer, int i, int i1) {
791 -// boolean videoMode = mPresenter.isVideoMode();  
792 -  
793 -// if (videoMode && PLMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START == i) {  
794 -//// initPic.setVisibility(View.INVISIBLE);  
795 -// }  
796 return false; 713 return false;
797 } 714 }
798 715
@@ -917,12 +834,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -917,12 +834,6 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
917 mShowing = false; 834 mShowing = false;
918 } 835 }
919 } 836 }
920 -private boolean pause=true;  
921 - /**  
922 - * 退出标记  
923 - */  
924 - private boolean quit;  
925 - private boolean isOver;  
926 public void updatePausePlay() { 837 public void updatePausePlay() {
927 if (pause) 838 if (pause)
928 mPauseButton.setImageResource(R.mipmap.play); 839 mPauseButton.setImageResource(R.mipmap.play);
@@ -948,27 +859,15 @@ private boolean pause=true; @@ -948,27 +859,15 @@ private boolean pause=true;
948 case Constants.RECORD_SEEK: 859 case Constants.RECORD_SEEK:
949 isOver = false; 860 isOver = false;
950 pause = false; 861 pause = false;
951 -// int keyFrameSeek = jsonObject.optInt("keyFrameSeekTime");  
952 -// mRootView.seek(keyFrameSeek);  
953 break; 862 break;
954 case Constants.RECORD_STOP: 863 case Constants.RECORD_STOP:
955 pause = true; 864 pause = true;
956 // //停止后 录制回放要进行初始化 865 // //停止后 录制回放要进行初始化
957 if (!quit) {//回放结束了 866 if (!quit) {//回放结束了
958 -// isOver = true;  
959 -// if (currentTime < recordPlaybackMaxTime)  
960 -// currentTime++;  
961 -// xdySdk.api("initRecordPlayback", initClass);  
962 -// int classId = AccountUtils.getUser().getClassId();  
963 -// mModel.initRecordPlayback(classId, portal, userRole, userId);  
964 // //停止视频 867 // //停止视频
965 stopVideo(); 868 stopVideo();
966 currentTime = 0; 869 currentTime = 0;
967 resetSeekBar(); 870 resetSeekBar();
968 -// docView.clear();  
969 -// chatView.clearChatHistory();  
970 -// currentPlayAudio = null;  
971 -// currentPlayVideo = null;  
972 EventBus.getDefault().post("doc"); 871 EventBus.getDefault().post("doc");
973 EventBus.getDefault().post("chat"); 872 EventBus.getDefault().post("chat");
974 } 873 }
@@ -991,22 +890,7 @@ private boolean pause=true; @@ -991,22 +890,7 @@ private boolean pause=true;
991 */ 890 */
992 public void initRecordSeek(String response){ 891 public void initRecordSeek(String response){
993 892
994 - JSONObject jsonObject = null;  
995 -  
996 - try {  
997 - jsonObject = new JSONObject(response);  
998 - seek = jsonObject.optLong("recordPlaybackMaxTime");  
999 - } catch (JSONException e) {  
1000 - e.printStackTrace();  
1001 - }  
1002 -// if (mVideoView.isPlaying()) {  
1003 -// mVideoView.stopPlayback();  
1004 -// }  
1005 -// if (replay && seek > 0) {  
1006 -// mVideoView.seekTo(seek * 1000);  
1007 -  
1008 setProgress(); 893 setProgress();
1009 -//  
1010 mHandler.postDelayed(new Runnable() { 894 mHandler.postDelayed(new Runnable() {
1011 @Override 895 @Override
1012 public void run() { 896 public void run() {
@@ -1019,30 +903,15 @@ private boolean pause=true; @@ -1019,30 +903,15 @@ private boolean pause=true;
1019 private void handleTime(String pa) { 903 private void handleTime(String pa) {
1020 try { 904 try {
1021 JSONObject jsonObject = new JSONObject(pa); 905 JSONObject jsonObject = new JSONObject(pa);
1022 -  
1023 //防止时间超了 906 //防止时间超了
1024 currentTime = jsonObject.optInt("classTimestamp"); 907 currentTime = jsonObject.optInt("classTimestamp");
1025 boolean isRe = jsonObject.optBoolean("recordStatus"); 908 boolean isRe = jsonObject.optBoolean("recordStatus");
1026 909
1027 -  
1028 -  
1029 } catch (JSONException e) { 910 } catch (JSONException e) {
1030 e.printStackTrace(); 911 e.printStackTrace();
1031 } 912 }
1032 setProgress(); 913 setProgress();
1033 } 914 }
1034 -  
1035 -// public void setProcess(){  
1036 -// if (mEndTime != null)  
1037 -// mEndTime.setText(generateTime(seek));  
1038 -// if (mCurrentTime != null) {  
1039 -// mCurrentTime.setText(generateTime(currentTime));  
1040 -// }  
1041 -// if (mSeekBar != null){  
1042 -//// mSeekBar.setProgress(generateTime(currentTime));  
1043 -// }  
1044 -// }  
1045 -  
1046 public boolean getRecordStatus() { 915 public boolean getRecordStatus() {
1047 return pause; 916 return pause;
1048 } 917 }
@@ -1074,17 +943,13 @@ private boolean pause=true; @@ -1074,17 +943,13 @@ private boolean pause=true;
1074 img_playVideo_novideo.setVisibility(View.GONE); 943 img_playVideo_novideo.setVisibility(View.GONE);
1075 if (mVideoView.isPlaying()) { 944 if (mVideoView.isPlaying()) {
1076 mVideoView.stopPlayback(); 945 mVideoView.stopPlayback();
1077 -// mVideoView.pause();  
1078 } 946 }
1079 mVideoView.setVideoPath(videoPlayBean.getReplay()); 947 mVideoView.setVideoPath(videoPlayBean.getReplay());
1080 - //TODO 这个地方需要调整进度的话  
1081 - XdyLogUtil.e("播放精度哈哈哈哈哈",""+videoPlayBean.getSeek());  
1082 if (replay && videoPlayBean.getSeek() > 0) { 948 if (replay && videoPlayBean.getSeek() > 0) {
1083 949
1084 mVideoView.seekTo(videoPlayBean.getSeek() * 1000); 950 mVideoView.seekTo(videoPlayBean.getSeek() * 1000);
1085 } 951 }
1086 mVideoView.start(); 952 mVideoView.start();
1087 - XdyLogUtil.e("录制回放播放视频的了",""+videoPlayBean.getReplay());  
1088 } 953 }
1089 } 954 }
1090 955
@@ -1140,6 +1005,5 @@ private boolean pause=true; @@ -1140,6 +1005,5 @@ private boolean pause=true;
1140 public void seekRecordPlayback(long time) { 1005 public void seekRecordPlayback(long time) {
1141 TimeEntity timeEntity=new TimeEntity(time); 1006 TimeEntity timeEntity=new TimeEntity(time);
1142 xdySdk.api("seekRecordPlayback", new Gson().toJson(timeEntity)); 1007 xdySdk.api("seekRecordPlayback", new Gson().toJson(timeEntity));
1143 -  
1144 } 1008 }
1145 } 1009 }
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 android:layout_width="match_parent" 16 android:layout_width="match_parent"
17 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
18 android:hint="请输入课堂号" 18 android:hint="请输入课堂号"
19 - android:text="391813551"/> 19 + android:text="1332699420"/>
20 <TextView 20 <TextView
21 android:layout_width="match_parent" 21 android:layout_width="match_parent"
22 android:layout_height="wrap_content" 22 android:layout_height="wrap_content"
@@ -64,11 +64,4 @@ @@ -64,11 +64,4 @@
64 android:text="录制回放" 64 android:text="录制回放"
65 /> 65 />
66 66
67 - <Button  
68 - android:id="@+id/btn_home_enter_publisherAudio"  
69 - android:layout_width="match_parent"  
70 - android:layout_height="wrap_content"  
71 - android:text="推音频"  
72 - android:visibility="gone"  
73 - />  
74 </LinearLayout> 67 </LinearLayout>
@@ -6,15 +6,6 @@ @@ -6,15 +6,6 @@
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 android:orientation="vertical" 7 android:orientation="vertical"
8 tools:context="com.mang.xdy.demo.activity.VideoPlayActivity"> 8 tools:context="com.mang.xdy.demo.activity.VideoPlayActivity">
9 -  
10 - <FrameLayout  
11 - android:id="@+id/fl_videoview_container"  
12 - android:layout_width="match_parent"  
13 - android:layout_height="1dp"  
14 - android:visibility="gone">  
15 -  
16 -  
17 - </FrameLayout>  
18 <RelativeLayout 9 <RelativeLayout
19 android:layout_width="match_parent" 10 android:layout_width="match_parent"
20 android:layout_height="@dimen/ui_DIMEN_500.0PX"> 11 android:layout_height="@dimen/ui_DIMEN_500.0PX">
@@ -28,10 +19,8 @@ @@ -28,10 +19,8 @@
28 android:layout_width="match_parent" 19 android:layout_width="match_parent"
29 android:layout_height="match_parent" 20 android:layout_height="match_parent"
30 /> 21 />
31 - <!--<FrameLayout-->  
32 - <!--android:layout_width="match_parent"-->  
33 - <!--android:layout_height="match_parent">-->  
34 - 22 + android:layout_width="match_parent"
  23 + android:layout_height="match_parent">
35 <ImageView 24 <ImageView
36 android:id="@+id/img_playVideo_novideo" 25 android:id="@+id/img_playVideo_novideo"
37 android:layout_width="match_parent" 26 android:layout_width="match_parent"
@@ -39,25 +28,89 @@ @@ -39,25 +28,89 @@
39 android:background="@mipmap/novideo" 28 android:background="@mipmap/novideo"
40 /> 29 />
41 <FrameLayout 30 <FrameLayout
42 - android:layout_width="wrap_content" 31 + android:layout_width="match_parent"
43 android:layout_height="wrap_content"> 32 android:layout_height="wrap_content">
44 - <FrameLayout  
45 - android:id="@+id/fra_videoPlay_publish"  
46 - android:layout_width="150dp"  
47 - android:layout_gravity="right|bottom"  
48 - android:layout_height="100dp">  
49 - <Button  
50 - android:id="@+id/btn_videoPlay_exit" 33 +
  34 + </FrameLayout>
  35 + <LinearLayout
51 android:layout_width="wrap_content" 36 android:layout_width="wrap_content"
52 android:layout_height="wrap_content" 37 android:layout_height="wrap_content"
53 - android:text="开始推流"  
54 - android:visibility="gone" 38 + android:orientation="vertical"
  39 + android:layout_alignParentRight="true"
  40 + android:id="@+id/linearLayout">
55 41
56 - />  
57 - </FrameLayout> 42 + </LinearLayout>
  43 + <RelativeLayout
  44 + android:layout_width="wrap_content"
  45 + android:layout_height="wrap_content"
  46 + android:layout_alignParentRight="true"
  47 + android:layout_alignParentBottom="true"
  48 + android:layout_below="@+id/linearLayout"
  49 + android:layout_alignParentLeft="true"
  50 + android:layout_alignParentStart="true">
  51 + <RelativeLayout
  52 + android:id="@+id/avg_videoPlay_back"
  53 + android:layout_width="match_parent"
  54 + android:layout_height="wrap_content"
  55 + android:layout_alignParentLeft="true"
  56 + android:layout_alignParentStart="true"
  57 + android:layout_alignParentTop="true"
  58 + android:paddingLeft="@dimen/ui_DIMEN_20.0PX"
  59 + android:paddingRight="@dimen/ui_DIMEN_20.0PX">
58 60
59 - </FrameLayout> 61 + <ImageView
  62 + android:id="@+id/img_videoPlay_back"
  63 + android:layout_width="wrap_content"
  64 + android:layout_height="@dimen/ui_titlebar_height"
  65 + android:paddingRight="20dp"
  66 + android:paddingLeft="15dp"
  67 + android:src="@mipmap/back"/>
  68 + <TextView
  69 + android:id="@+id/tv_videoPlay_className"
  70 + style="@style/ui_wrapTvBaseStyle"
  71 + android:layout_height="@dimen/ui_titlebar_height"
  72 + android:layout_centerHorizontal="true"
  73 + android:gravity="center"
  74 + android:textColor="@color/white"
  75 + tools:text="hahaha"
  76 + android:textSize="@dimen/ui_DIMEN_34.0PX"/>
  77 + </RelativeLayout>
  78 + <SurfaceView
  79 + android:id="@+id/sur_plaVideo_publish"
  80 + android:layout_width="120dp"
  81 + android:layout_height="150dp"
  82 + android:visibility="gone"
  83 + tools:visibility="visible"
  84 + android:layout_alignParentRight="true"
  85 + android:layout_alignParentBottom="true"
  86 + />
60 87
  88 + <ImageView
  89 + android:id="@+id/img_videoPlay_start"
  90 + android:layout_width="wrap_content"
  91 + android:layout_height="wrap_content"
  92 + android:layout_marginRight="25dp"
  93 + android:layout_marginBottom="20dp"
  94 + android:visibility="gone"
  95 + tools:visibility="visible"
  96 + android:layout_alignParentRight="true"
  97 + android:layout_alignParentBottom="true"
  98 + android:background="@mipmap/camerap_normal2x"
  99 + />
  100 + <ImageView
  101 + android:id="@+id/img_videoPlay_stopPublish"
  102 + android:layout_width="wrap_content"
  103 + android:layout_height="wrap_content"
  104 + android:layout_alignBottom="@+id/sur_plaVideo_publish"
  105 + android:enabled="false"
  106 + android:background="@mipmap/hangup_normal2x"
  107 + android:visibility="gone"
  108 + android:layout_marginRight="25dp"
  109 + android:layout_marginBottom="20dp"
  110 + tools:visibility="visible"
  111 + android:layout_alignParentRight="true"
  112 + />
  113 + </RelativeLayout>
61 </RelativeLayout> 114 </RelativeLayout>
62 <SurfaceView 115 <SurfaceView
63 android:id="@+id/surfaceview_playVideo_text" 116 android:id="@+id/surfaceview_playVideo_text"
@@ -66,24 +119,15 @@ @@ -66,24 +119,15 @@
66 android:visibility="gone"/> 119 android:visibility="gone"/>
67 <FrameLayout 120 <FrameLayout
68 android:layout_width="wrap_content" 121 android:layout_width="wrap_content"
69 - android:layout_height="wrap_content">  
70 - <Button  
71 - android:id="@+id/btn_videoPlay_stopPublish"  
72 - android:layout_width="wrap_content"  
73 android:layout_height="wrap_content" 122 android:layout_height="wrap_content"
74 - android:text="结束按钮"  
75 - android:visibility="gone"  
76 - /> 123 + android:orientation="horizontal"
  124 + >
77 </FrameLayout> 125 </FrameLayout>
78 <android.support.design.widget.TabLayout 126 <android.support.design.widget.TabLayout
79 android:id="@+id/sliding_tabs" 127 android:id="@+id/sliding_tabs"
80 android:layout_width="match_parent" 128 android:layout_width="match_parent"
81 android:layout_height="wrap_content" 129 android:layout_height="wrap_content"
82 /> 130 />
83 -  
84 -  
85 - <!--</FrameLayout>-->  
86 -  
87 <com.mang.xdy.demo.widget.view.NoScrollViewPager 131 <com.mang.xdy.demo.widget.view.NoScrollViewPager
88 android:id="@+id/viewpager" 132 android:id="@+id/viewpager"
89 android:layout_width="match_parent" 133 android:layout_width="match_parent"
@@ -96,7 +140,6 @@ @@ -96,7 +140,6 @@
96 android:layout_height="wrap_content" 140 android:layout_height="wrap_content"
97 android:layout_alignParentBottom="true" 141 android:layout_alignParentBottom="true"
98 > 142 >
99 -  
100 <include 143 <include
101 layout="@layout/home_media_controller" 144 layout="@layout/home_media_controller"
102 android:layout_width="match_parent" 145 android:layout_width="match_parent"
@@ -41,8 +41,6 @@ @@ -41,8 +41,6 @@
41 android:gravity="end" 41 android:gravity="end"
42 tools:text="12:00:12"/> 42 tools:text="12:00:12"/>
43 43
44 -  
45 -  
46 <TextView 44 <TextView
47 android:id="@+id/tv_end_time" 45 android:id="@+id/tv_end_time"
48 style="@style/ui_wrapTvBaseStyle" 46 style="@style/ui_wrapTvBaseStyle"
@@ -51,7 +49,6 @@ @@ -51,7 +49,6 @@
51 android:textColor="@color/white" 49 android:textColor="@color/white"
52 tools:text="12:00"/> 50 tools:text="12:00"/>
53 51
54 -  
55 <SeekBar 52 <SeekBar
56 android:id="@+id/sb_live" 53 android:id="@+id/sb_live"
57 style="@style/home_seek_bar" 54 style="@style/home_seek_bar"
1 -//package com.mang.xdy.api;  
2 -//  
3 -//import android.content.Context;  
4 -//  
5 -//  
6 -//import com.mang.xdy.common.Constants;  
7 -//import com.mang.xdy.core.XdyCore;  
8 -//import com.mang.xdy.utils.XdyLogUtil;  
9 -//  
10 -///**  
11 -// * 对外调用的接口  
12 -// * Created by abao on 2017/3/31.  
13 -// */  
14 -//public class XdyInterface {  
15 -// /**  
16 -// * 用户初始化,还是调用各种方法,都需要统一的对外给出监听事件  
17 -// */  
18 -// private static XdyCore mXdyCore;  
19 -// private static XdyInterface mXdyInterface;  
20 -//  
21 -// /**  
22 -// * 对外提供的异步消息接收接口(可以多个吗?)  
23 -// */  
24 -// public interface OnXdyAsyncMessageLitener{  
25 -// /**  
26 -// *  
27 -// * @param type 接收到的数据类型  
28 -// * @param response 返回数据  
29 -// */  
30 -// void onXdyAsyncMessageReceiver(String type,String response);  
31 -// }  
32 -// private static OnXdyAsyncMessageLitener mOnXdyAsyncMessageLitener;  
33 -//  
34 -// /**  
35 -// * 设置监听  
36 -// */  
37 -// public void setOnXdyAsyncMessageLitener(OnXdyAsyncMessageLitener onXdyAsyncMessageLitener){  
38 -// mOnXdyAsyncMessageLitener=onXdyAsyncMessageLitener;  
39 -// }  
40 -// private XdyInterface(){}  
41 -// /**  
42 -// * 初始化  
43 -// * @param context  
44 -// */  
45 -// public static void init(Context context){  
46 -// if(context==null){  
47 -// throw new IllegalArgumentException(Constants.ERROR_CONTENT_NULL);  
48 -// }  
49 -// mXdyCore = XdyCore.getInstance(context);  
50 -// mXdyCore.setXdyAsyncMessageListener(new XdyCore.OnXdyAsyncMessageListener() {  
51 -// @Override  
52 -// public void getSdyAsyncMessageListener(String id, String parameter) {  
53 -// XdyLogUtil.e(null,""+"xdy init success");  
54 -// if(mOnXdyAsyncMessageLitener!=null){  
55 -// mOnXdyAsyncMessageLitener.onXdyAsyncMessageReceiver(id,parameter);  
56 -// }  
57 -// }  
58 -// });  
59 -// }  
60 -//  
61 -// /**  
62 -// * 接收用户传递进来的参数  
63 -// */  
64 -// public static void setAsyncApi(String type,String argument){  
65 -// judgeCore();  
66 -// mXdyCore.native2js(type,argument);  
67 -// }  
68 -// /*判断是否被初始化*/  
69 -// public static void judgeCore(){  
70 -// if(mXdyCore==null){  
71 -// throw new IllegalArgumentException(Constants.ERROR_XDYCORE_INIT);  
72 -// }  
73 -//  
74 -// }  
75 -// public static XdyInterface getXdyInstance(){  
76 -// if(mXdyInterface==null){  
77 -// synchronized (XdyInterface.class){  
78 -// mXdyInterface=new XdyInterface();  
79 -// }  
80 -// }  
81 -// return mXdyInterface;  
82 -// }  
83 -//}  
1 package com.mang.xdy.cache; 1 package com.mang.xdy.cache;
2 -/**  
3 - * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).  
4 - *  
5 - * Licensed under the Apache License, Version 2.0 (the "License");  
6 - * you may not use this file except in compliance with the License.  
7 - * You may obtain a copy of the License at  
8 - *  
9 - * http://www.apache.org/licenses/LICENSE-2.0  
10 - *  
11 - * Unless required by applicable law or agreed to in writing, software  
12 - * distributed under the License is distributed on an "AS IS" BASIS,  
13 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
14 - * See the License for the specific language governing permissions and  
15 - * limitations under the License.  
16 - */  
17 2
18 import android.content.Context; 3 import android.content.Context;
19 import android.graphics.Bitmap; 4 import android.graphics.Bitmap;
@@ -196,7 +196,7 @@ public interface Constants { @@ -196,7 +196,7 @@ public interface Constants {
196 /** 196 /**
197 * 断线重连时间间隔 197 * 断线重连时间间隔
198 */ 198 */
199 - long TIME_NET_ERROR_RECONNECTION=6000; 199 + long TIME_NET_ERROR_RECONNECTION=5000;
200 200
201 /**********************************以下实现为自定义code 先定义后实现*********************************************************************/ 201 /**********************************以下实现为自定义code 先定义后实现*********************************************************************/
202 /** 202 /**
@@ -157,6 +157,7 @@ public class XdyPlayerCore { @@ -157,6 +157,7 @@ public class XdyPlayerCore {
157 libPlayer.SmartPlayerClose(playerHandle); 157 libPlayer.SmartPlayerClose(playerHandle);
158 playerHandle = 0; 158 playerHandle = 0;
159 } 159 }
  160 + isPlaying = false;
160 } 161 }
161 /** 162 /**
162 * 停止播放,重置正在播放标识 163 * 停止播放,重置正在播放标识
@@ -55,6 +55,7 @@ public class XdySdk implements SubjectListener{ @@ -55,6 +55,7 @@ public class XdySdk implements SubjectListener{
55 private static MsgManage mMsgManage; 55 private static MsgManage mMsgManage;
56 56
57 public static String TAG="xdysdk"; 57 public static String TAG="xdysdk";
  58 + /*当前播放视频的id*/
58 private String currentPlayId=""; 59 private String currentPlayId="";
59 /*缓存管理*/ 60 /*缓存管理*/
60 private static ACache aCache; 61 private static ACache aCache;
@@ -73,6 +74,8 @@ public class XdySdk implements SubjectListener{ @@ -73,6 +74,8 @@ public class XdySdk implements SubjectListener{
73 private List<ObserverListener> observerListenerList=new ArrayList<ObserverListener>(); 74 private List<ObserverListener> observerListenerList=new ArrayList<ObserverListener>();
74 /*推流地址*/ 75 /*推流地址*/
75 private String publish_url=""; 76 private String publish_url="";
  77 + /*保存nodeid ,自己的唯一标识*/
  78 + private int nodeId=0;
76 79
77 @Override 80 @Override
78 public void add(ObserverListener observerListener) { 81 public void add(ObserverListener observerListener) {
@@ -94,29 +97,6 @@ public class XdySdk implements SubjectListener{ @@ -94,29 +97,6 @@ public class XdySdk implements SubjectListener{
94 } 97 }
95 } 98 }
96 } 99 }
97 -  
98 -  
99 -  
100 - /**  
101 - * 对外提供的异步消息接收接口)  
102 - */  
103 - public interface OnXdyAsyncMessageLitener{  
104 - /**  
105 - *  
106 - * @param type 接收到的数据类型  
107 - * @param response 返回数据  
108 - */  
109 - void onXdyAsyncMessageReceiver(String type, String response);  
110 - }  
111 - private OnXdyAsyncMessageLitener mOnXdyAsyncMessageLitener;  
112 -  
113 - /**  
114 - * 设置监听  
115 - */  
116 - public void setOnXdyAsyncMessageLitener(OnXdyAsyncMessageLitener onXdyAsyncMessageLitener){  
117 - judgeCore();  
118 - mOnXdyAsyncMessageLitener=onXdyAsyncMessageLitener;  
119 - }  
120 private XdySdk(){} 100 private XdySdk(){}
121 101
122 private static Handler handler=new Handler(){ 102 private static Handler handler=new Handler(){
@@ -191,15 +171,11 @@ public class XdySdk implements SubjectListener{ @@ -191,15 +171,11 @@ public class XdySdk implements SubjectListener{
191 judgeString(type); 171 judgeString(type);
192 switch (type) { 172 switch (type) {
193 case Constants.PLAY_AUDIO: 173 case Constants.PLAY_AUDIO:
194 - //播放音频  
195 - /**  
196 - * 判断mediaId (仅播放需要)通过取得value 如果为空的话表示输入的数据有误  
197 - *  
198 - */ 174 + //判断mediaId (仅播放需要)通过取得value 如果为空的话表示输入的数据有误
199 String json_audio= aCache.getAsString(mediaId); 175 String json_audio= aCache.getAsString(mediaId);
200 if(TextUtils.isEmpty(json_audio)){ 176 if(TextUtils.isEmpty(json_audio)){
201 //TODO/给出相应的提示表示没有 这个id 177 //TODO/给出相应的提示表示没有 这个id
202 - XdyLogUtil.e(TAG,"Play Audio Can not find this AudioId"); 178 + XdyLogUtil.e(TAG,"Play Audio Can not find this mediaId");
203 return; 179 return;
204 } 180 }
205 currentPlayId=mediaId; 181 currentPlayId=mediaId;
@@ -207,7 +183,7 @@ public class XdySdk implements SubjectListener{ @@ -207,7 +183,7 @@ public class XdySdk implements SubjectListener{
207 if(audioPlayBean!=null) { 183 if(audioPlayBean!=null) {
208 String play_url_audio=""; 184 String play_url_audio="";
209 if(isRecordPlayBack){ 185 if(isRecordPlayBack){
210 - play_url_audio=audioPlayBean.getReplay(); 186 + //如果是回放给出。m3u8的id用户 用户需要自己获取play_url_audio=audioPlayBean.getReplay();
211 }else{ 187 }else{
212 play_url_audio=audioPlayBean.getRtmpUrl() ; 188 play_url_audio=audioPlayBean.getRtmpUrl() ;
213 if(mXdyPlayerCore==null) { 189 if(mXdyPlayerCore==null) {
@@ -224,14 +200,11 @@ public class XdySdk implements SubjectListener{ @@ -224,14 +200,11 @@ public class XdySdk implements SubjectListener{
224 break; 200 break;
225 case Constants.PLAY_VIDEO: 201 case Constants.PLAY_VIDEO:
226 //播放视频 202 //播放视频
227 - /**  
228 - * 判断mediaId (仅播放需要)通过取得value 如果为空的话表示输入的数据有误  
229 - *  
230 - */ 203 + // 判断mediaId (仅播放需要)通过取得value 如果为空的话表示输入的数据有误
231 String json_video= aCache.getAsString(mediaId); 204 String json_video= aCache.getAsString(mediaId);
232 if(TextUtils.isEmpty(json_video)){ 205 if(TextUtils.isEmpty(json_video)){
233 ///给出相应的提示表示没有 这个id 206 ///给出相应的提示表示没有 这个id
234 - XdyLogUtil.e(TAG,"Play Video Can not find this VideoId"); 207 + XdyLogUtil.e(TAG,"Play Video Can not find this mediaId");
235 return; 208 return;
236 } 209 }
237 currentPlayId=mediaId; 210 currentPlayId=mediaId;
@@ -239,7 +212,7 @@ public class XdySdk implements SubjectListener{ @@ -239,7 +212,7 @@ public class XdySdk implements SubjectListener{
239 if(videoPlayBean!=null){ 212 if(videoPlayBean!=null){
240 String play_url_video=""; 213 String play_url_video="";
241 if(isRecordPlayBack){ 214 if(isRecordPlayBack){
242 - play_url_video=videoPlayBean.getReplay(); 215 +// play_url_video=videoPlayBean.getReplay();
243 }else{ 216 }else{
244 play_url_video=videoPlayBean.getRtmpUrl(); 217 play_url_video=videoPlayBean.getRtmpUrl();
245 if(mXdyPlayerCore==null) { 218 if(mXdyPlayerCore==null) {
@@ -257,13 +230,11 @@ public class XdySdk implements SubjectListener{ @@ -257,13 +230,11 @@ public class XdySdk implements SubjectListener{
257 } 230 }
258 break; 231 break;
259 case Constants.PUBLISH_VIDEO: 232 case Constants.PUBLISH_VIDEO:
260 - //打开推流视频  
261 /** 233 /**
262 * 用户发起这个推流的请求的时候, 234 * 用户发起这个推流的请求的时候,
263 * 1,去获取推流地址 235 * 1,去获取推流地址
264 * 2,判断地址时候有用,有用的话打开播放器,开启推流的过程 236 * 2,判断地址时候有用,有用的话打开播放器,开启推流的过程
265 * 3,推流成功告知后台,和用户 237 * 3,推流成功告知后台,和用户
266 - *  
267 */ 238 */
268 getPublishPathVideo(); 239 getPublishPathVideo();
269 mSurfaceView_Publish=surfaceView; 240 mSurfaceView_Publish=surfaceView;
@@ -335,6 +306,7 @@ public class XdySdk implements SubjectListener{ @@ -335,6 +306,7 @@ public class XdySdk implements SubjectListener{
335 try { 306 try {
336 jsonObject = new JSONObject(response); 307 jsonObject = new JSONObject(response);
337 isRecordPlayBack = jsonObject.optBoolean("isRecordPlayBack"); 308 isRecordPlayBack = jsonObject.optBoolean("isRecordPlayBack");
  309 + nodeId=jsonObject.optInt("nodeId");
338 } catch (JSONException e) { 310 } catch (JSONException e) {
339 e.printStackTrace(); 311 e.printStackTrace();
340 } 312 }
@@ -346,7 +318,6 @@ public class XdySdk implements SubjectListener{ @@ -346,7 +318,6 @@ public class XdySdk implements SubjectListener{
346 // String publishPath=XdyStringUtils.stringToJson(response); 318 // String publishPath=XdyStringUtils.stringToJson(response);
347 String publishPath=response; 319 String publishPath=response;
348 GetPublishPathReceiveBean getPublishPathReceiveBean=JsonUtil.parseJsonToBean(publishPath,GetPublishPathReceiveBean.class); 320 GetPublishPathReceiveBean getPublishPathReceiveBean=JsonUtil.parseJsonToBean(publishPath,GetPublishPathReceiveBean.class);
349 -  
350 if(getPublishPathReceiveBean!=null) { 321 if(getPublishPathReceiveBean!=null) {
351 //可以推流了 322 //可以推流了
352 if (getPublishPathReceiveBean.getCode() == 0) { 323 if (getPublishPathReceiveBean.getCode() == 0) {
@@ -364,6 +335,9 @@ public class XdySdk implements SubjectListener{ @@ -364,6 +335,9 @@ public class XdySdk implements SubjectListener{
364 } 335 }
365 if (mXdyPublisherCore == null) { 336 if (mXdyPublisherCore == null) {
366 mXdyPublisherCore = new XdyPublisherCore(1, 1, mActivity); 337 mXdyPublisherCore = new XdyPublisherCore(1, 1, mActivity);
  338 + }else{
  339 + //todo 如果不为空的话是已经播放过,得清理上次的
  340 + mXdyPlayerCore.onPause();
367 } 341 }
368 publish_url=video_url; 342 publish_url=video_url;
369 isPublisher =true; 343 isPublisher =true;
@@ -377,7 +351,11 @@ public class XdySdk implements SubjectListener{ @@ -377,7 +351,11 @@ public class XdySdk implements SubjectListener{
377 } 351 }
378 }else{ 352 }else{
379 //给出提示 353 //给出提示
380 - mMsgManage.getPublishVideoPathError(); 354 + //TODO
  355 + handleListener(Constants.ERROR_CODE,"{\n" +
  356 + " \"code\": 804,\n" +
  357 + " \"reson\": \"推流失败\"\n" +
  358 + "}");
381 } 359 }
382 break; 360 break;
383 case Constants.AUDIO_GET_PUBLISH_PATH: 361 case Constants.AUDIO_GET_PUBLISH_PATH:
@@ -401,8 +379,12 @@ public class XdySdk implements SubjectListener{ @@ -401,8 +379,12 @@ public class XdySdk implements SubjectListener{
401 XdyLogUtil.e(TAG,"activity is null"); 379 XdyLogUtil.e(TAG,"activity is null");
402 return; 380 return;
403 } 381 }
404 - if(mXdyPublisherCore==null)  
405 - mXdyPublisherCore=new XdyPublisherCore(1,0,mActivity); 382 + if(mXdyPublisherCore==null) {
  383 + mXdyPublisherCore = new XdyPublisherCore(1, 0, mActivity);
  384 + }else {
  385 + //todo 如果不为空的话是已经播放过,得清理上次的
  386 + mXdyPlayerCore.onPause();
  387 + }
406 mXdyPublisherCore.publisherAudio(audio_url,new EventHande_Publish()); 388 mXdyPublisherCore.publisherAudio(audio_url,new EventHande_Publish());
407 publish_url=audio_url; 389 publish_url=audio_url;
408 isPublisher =true; 390 isPublisher =true;
@@ -411,7 +393,11 @@ public class XdySdk implements SubjectListener{ @@ -411,7 +393,11 @@ public class XdySdk implements SubjectListener{
411 PlayerUtils.setPublishSendSuccessAudio(audio_url); 393 PlayerUtils.setPublishSendSuccessAudio(audio_url);
412 }else{ 394 }else{
413 //给出提示 395 //给出提示
414 - mMsgManage.getPublishVideoPathError(); 396 + //TODO
  397 + handleListener(Constants.ERROR_CODE,"{\n" +
  398 + " \"code\": 804,\n" +
  399 + " \"reson\": \"推流失败\"\n" +
  400 + "}");
415 } 401 }
416 break; 402 break;
417 case Constants.PUBLISH_AUDIO: 403 case Constants.PUBLISH_AUDIO:
@@ -454,17 +440,22 @@ public class XdySdk implements SubjectListener{ @@ -454,17 +440,22 @@ public class XdySdk implements SubjectListener{
454 String video=response; 440 String video=response;
455 VideoPlayBean videoPlayBean= JsonUtil.parseJsonToBean(video,VideoPlayBean.class); 441 VideoPlayBean videoPlayBean= JsonUtil.parseJsonToBean(video,VideoPlayBean.class);
456 if(videoPlayBean!=null) { 442 if(videoPlayBean!=null) {
457 - if(videoPlayBean.getMediaId()!=videoPlayBean.getFromNodeId()) { 443 +// if(videoPlayBean.getMediaId()!=videoPlayBean.getFromNodeId()) {
  444 + if(nodeId!=videoPlayBean.getFromNodeId()) {
  445 + //过滤自己推送的video
458 aCache.put(videoPlayBean.getMediaId() + "", video); 446 aCache.put(videoPlayBean.getMediaId() + "", video);
459 handleListener(type, videoPlayBean.getMediaId() + ""); 447 handleListener(type, videoPlayBean.getMediaId() + "");
460 } 448 }
  449 + }else{
  450 + XdyLogUtil.e(TAG,"video play json error");
461 } 451 }
462 break; 452 break;
463 case Constants.AUDIO_PLAY: 453 case Constants.AUDIO_PLAY:
464 String audio=response; 454 String audio=response;
465 AudioPlayBean audioPlayBean=JsonUtil.parseJsonToBean(audio,AudioPlayBean.class); 455 AudioPlayBean audioPlayBean=JsonUtil.parseJsonToBean(audio,AudioPlayBean.class);
466 if(audioPlayBean!=null){ 456 if(audioPlayBean!=null){
467 - if(audioPlayBean.getMediaId()!=audioPlayBean.getFromNodeId()) { 457 +// if(audioPlayBean.getMediaId()!=audioPlayBean.getFromNodeId()) {
  458 + if(nodeId!=audioPlayBean.getFromNodeId()) {
468 aCache.put(audioPlayBean.getMediaId() + "", audio); 459 aCache.put(audioPlayBean.getMediaId() + "", audio);
469 handleListener(type, audioPlayBean.getMediaId() + ""); 460 handleListener(type, audioPlayBean.getMediaId() + "");
470 } 461 }
@@ -483,7 +474,7 @@ public class XdySdk implements SubjectListener{ @@ -483,7 +474,7 @@ public class XdySdk implements SubjectListener{
483 if(isPublisher) { 474 if(isPublisher) {
484 if(!NetWorkUtils.isNetworkConnected(mContext)){ 475 if(!NetWorkUtils.isNetworkConnected(mContext)){
485 //todo判断是否有网络,没有网络的话就让其退出 476 //todo判断是否有网络,没有网络的话就让其退出
486 - // TOdo 延迟10秒, 477 + // TOdo 延迟5秒,
487 // onPublisherStop(); 478 // onPublisherStop();
488 handler.sendEmptyMessageDelayed(Constants.LEAVE_CLASS_CODE,Constants.TIME_NET_ERROR_RECONNECTION); 479 handler.sendEmptyMessageDelayed(Constants.LEAVE_CLASS_CODE,Constants.TIME_NET_ERROR_RECONNECTION);
489 } 480 }
@@ -517,9 +508,7 @@ public class XdySdk implements SubjectListener{ @@ -517,9 +508,7 @@ public class XdySdk implements SubjectListener{
517 * @param parameter 508 * @param parameter
518 */ 509 */
519 private void handleListener(String type,String parameter){ 510 private void handleListener(String type,String parameter){
520 - if(mOnXdyAsyncMessageLitener!=null){  
521 - mOnXdyAsyncMessageLitener.onXdyAsyncMessageReceiver(type,parameter);  
522 - } 511 + XdyLogUtil.e(TAG,"type:"+type+"parameter:"+parameter);
523 for(ObserverListener o:observerListenerList){ 512 for(ObserverListener o:observerListenerList){
524 o.observerUpData(type,parameter); 513 o.observerUpData(type,parameter);
525 } 514 }
@@ -551,6 +540,7 @@ public class XdySdk implements SubjectListener{ @@ -551,6 +540,7 @@ public class XdySdk implements SubjectListener{
551 if(mXdyJsCore!=null&&!isRecordPlayBack) { 540 if(mXdyJsCore!=null&&!isRecordPlayBack) {
552 mXdyJsCore.init(mContext); 541 mXdyJsCore.init(mContext);
553 } 542 }
  543 + onPublisherStop();
554 } 544 }
555 545
556 /** 546 /**
@@ -598,7 +588,7 @@ public class XdySdk implements SubjectListener{ @@ -598,7 +588,7 @@ public class XdySdk implements SubjectListener{
598 } 588 }
599 589
600 /** 590 /**
601 - * onResume 调用,目前是空方法 591 + *
602 * TODO 只有一个boolean 592 * TODO 只有一个boolean
603 * 开始isPublish 为false 593 * 开始isPublish 为false
604 * 开始推流初始化后onresume 就是开始 594 * 开始推流初始化后onresume 就是开始
1 -package com.mang.xdy;  
2 -  
3 -/**  
4 - * Created by abao on 2017/3/30.  
5 - */  
6 -  
7 -public class ss {  
8 -}  
@@ -17,7 +17,7 @@ import java.util.Map; @@ -17,7 +17,7 @@ import java.util.Map;
17 /** 17 /**
18 * 封装的是使用Gson解析json的方法 18 * 封装的是使用Gson解析json的方法
19 * 19 *
20 - * @author Administrator 20 + * @author abao
21 */ 21 */
22 public class JsonUtil { 22 public class JsonUtil {
23 23
@@ -31,14 +31,6 @@ public class XdyStringUtils { @@ -31,14 +31,6 @@ public class XdyStringUtils {
31 } 31 }
32 32
33 public static String stringToJson(String s){ 33 public static String stringToJson(String s){
34 -// StringBuffer sb = new StringBuffer();  
35 -// for(int i=0; i<s.length(); i++){  
36 -// char c =s.charAt(i);  
37 -// switch(c){  
38 -//// case'\"': sb.append(""); break;  
39 -// case'\'': sb.append(""); break;  
40 -// default: sb.append(c);  
41 -// }}  
42 String resString=""; 34 String resString="";
43 if(!TextUtils.isEmpty(s)&&s.length()>2) { 35 if(!TextUtils.isEmpty(s)&&s.length()>2) {
44 String temp = s.replace("\\", ""); 36 String temp = s.replace("\\", "");