作者 qin

视频页面

... ... @@ -53,7 +53,7 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
private String lessonOid;
private String accountOid;
// PlayerView play;
// PlayerView play;
OptimizeViewpager pager;
FrameLayout course_A, course_B, back;
... ... @@ -68,8 +68,7 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
TextView titleValue;
String title;
boolean isFinish = false;//判断视频是否加载完毕
boolean isCanStudy = false;//判断是否有权限观看这条视频
boolean canStudy = false;
private StandardGSYVideoPlayer player;
OrientationUtils orientationUtils;
... ... @@ -102,18 +101,8 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
introduce.setOnClickListener(this);
tv_list.setOnClickListener(this);
ListFragment listFragment = new ListFragment(lessonOid);
fragmentList.add(new IntroduceFragment());
fragmentList.add(listFragment);
listFragment.setOnClickListener(new ListFragment.OnClickListener() {
@Override
public void OnClick(int type, String lessonOid, String chapterOid, String sectionOid, String resourceOid, String playUrl) {
event = new Event(type, lessonOid, chapterOid, sectionOid, resourceOid, playUrl);
onResumeJC(event);
}
});
fragmentList.add(new ListFragment(lessonOid));
pagerAdapter = new MyViewPagerAdapter(getSupportFragmentManager());
pager.setOffscreenPageLimit(2);//设置ViewPage缓存界面数
... ... @@ -182,13 +171,7 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
Log.e("bean", bean.toString());
playUrl = bean.getChapterLst().get(0).getSectionLst().get(0).getResourceLst().get(0).getPlayUrl(); // html
Log.e("player", playUrl);
isCanStudy = bean.getChapterLst().get(0).getSectionLst().get(0).getResourceLst().get(0).isCanWatch();
if (!isCanStudy) {
start.setText("暂无权限");
} else {
start.setText("开始学习");
}
isFinish = true;
canStudy = true;
}
/* 发送消息 */
... ... @@ -199,8 +182,6 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
} else {
Log.e("Course_fail", "发送失败");
}
playVideo(event.getPlayUrl()); // 播放视频
handler.removeCallbacksAndMessages(null); // 关闭线程
}
... ... @@ -229,15 +210,11 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
this.finish();
break;
case R.id.course_detail_start: // 开始学习
if (!isFinish) {
if (canStudy == false) {
Toast.makeText(CourseDetailActivity_Video.this, "还未加载完毕...请稍等", Toast.LENGTH_SHORT).show();
return;
} else if (!isCanStudy) {
Toast.makeText(CourseDetailActivity_Video.this, "当前账号无权限,请拨打电话xxxxxxxxxx", Toast.LENGTH_SHORT).show();
return;
} else {
playVideo(playUrl);
}
playVideo(playUrl);
break;
case R.id.tv_introduce: // 介绍
pager.setCurrentItem(0, true);
... ... @@ -293,11 +270,10 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void handleEvent(Event event) {
this.event = event;
if (event.getCode() == 1) {
onResumeJC(event); // 先发送
// playVideo(event.getPlayUrl()); // 播放视频
playVideo(event.getPlayUrl()); // 播放视频
}
if (event.getCode() == 2) {
... ... @@ -330,7 +306,7 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
if ((urlA.substring(urlA.length() - 3, urlA.length())).trim().equals("tml")) {
course_A.setVisibility(View.GONE);
course_B.setVisibility(View.VISIBLE);
} else {
}else {
course_A.setVisibility(View.VISIBLE);
course_B.setVisibility(View.GONE);
}
... ... @@ -369,7 +345,7 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
if ((url.substring(url.length() - 3, url.length())).trim().equals("tml")) {
course_A.setVisibility(View.GONE);
course_B.setVisibility(View.VISIBLE);
} else {
}else {
course_A.setVisibility(View.VISIBLE);
course_B.setVisibility(View.GONE);
}
... ... @@ -421,7 +397,7 @@ public class CourseDetailActivity_Video extends BaseMvpActivity<CommonPresenter,
msg.what = 1;
handler.sendMessage(msg);
// Thread.sleep(1000);
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
... ...