huangxinbao

Restore the backstage playback without video

... ... @@ -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);
... ...
... ... @@ -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 {
... ...
... ... @@ -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"
... ...
... ... @@ -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"
/>
... ...