| | |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.ad.PlayVideoPreADFragment; |
| | | import com.weikou.beibeivideo.ui.common.ShareActivity; |
| | | import com.weikou.beibeivideo.ui.mine.FXBrowserActivity; |
| | | import com.weikou.beibeivideo.ui.video.FunshionPlayerFragment; |
| | | import com.weikou.beibeivideo.ui.video.VideoPlayerActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | |
| | | fl_video_play_background = findViewById(R.id.fl_video_play_background); |
| | | iv_background = findViewById(R.id.iv_video_play_background); |
| | | fl_ad = findViewById(R.id.fl_ad); |
| | | |
| | | initPlayer(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | .commitAllowingStateLoss(); |
| | | } |
| | | iNet(); |
| | | |
| | | if (fl_ad != null) |
| | | fl_ad.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | |
| | |
| | | VideoPlayerActivity.class); |
| | | intent.putExtra("url", playUrl.getUrl()); |
| | | startActivity(intent); |
| | | initPlayer(); |
| | | } else if (playUrl.getPlayType() == 2) { |
| | | iv_select_play.setVisibility(View.GONE); |
| | | iv_background.setClickable(false); |
| | |
| | | // EventBus.getDefault().post(playUrl); |
| | | Toast.makeText(VideoDetailActivity2.this, "影片加载中...", |
| | | Toast.LENGTH_LONG).show(); |
| | | initPlayer(); |
| | | } |
| | | saveWatchHistory("爱奇艺"); |
| | | } |
| | | |
| | | } else if (playUrl.getResource().getName().contains("风行")) { |
| | | |
| | | if (playUrl.getPlayType() == 0) { |
| | |
| | | Toast.LENGTH_LONG).show(); |
| | | return; |
| | | } else if (playUrl.getPlayType() == 1) { |
| | | // Intent intent = new Intent(VideoDetailActivity2.this, |
| | | // FXBrowserActivity.class); |
| | | // intent.putExtra("url", playUrl.getUrl()); |
| | | // startActivity(intent); |
| | | Intent intent = new Intent(VideoDetailActivity2.this, |
| | | FXBrowserActivity.class); |
| | | intent.putExtra("url", playUrl.getUrl()); |
| | | startActivity(intent); |
| | | saveWatchHistory("风行"); |
| | | } |
| | | fl_video_play_background.setVisibility(View.GONE); |
| | | //播放风行视频 |
| | | //添加风行播放页 |
| | | mFunshionPlayerFragment = new FunshionPlayerFragment(); |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putSerializable("videoInfo", videoInfo); |
| | | bundle.putSerializable("playUrl", playUrl); |
| | | bundle.putInt("position", mPosition); |
| | | bundle.putBoolean("collect", false); |
| | | bundle.putSerializable("resource", resource); |
| | | mFunshionPlayerFragment.setArguments(bundle); |
| | | if (!mFunshionPlayerFragment.isAdded()) { |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_video_play_container, mFunshionPlayerFragment).commit(); |
| | | initPlayer(); |
| | | } else if (playUrl.getPlayType() == 2) {//SDK播放 |
| | | //播放风行视频 |
| | | //添加风行播放页 |
| | | mFunshionPlayerFragment = new FunshionPlayerFragment(); |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putSerializable("videoInfo", videoInfo); |
| | | bundle.putSerializable("playUrl", playUrl); |
| | | bundle.putInt("position", mPosition); |
| | | bundle.putBoolean("collect", false); |
| | | bundle.putSerializable("resource", resource); |
| | | mFunshionPlayerFragment.setArguments(bundle); |
| | | if (!mFunshionPlayerFragment.isAdded()) { |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_video_play_container, mFunshionPlayerFragment).commit(); |
| | | } |
| | | fl_video_play_background.setVisibility(View.GONE); |
| | | } |
| | | |
| | | } else { |
| | |
| | | startActivity(intent); |
| | | saveWatchHistory(playUrl.getResource().getName()); |
| | | } |
| | | initPlayer(); |
| | | } |
| | | } |
| | | |
| | |
| | | public void onEventMainThread(Playlocation location) { |
| | | fl_ad.setVisibility(View.VISIBLE); |
| | | mPosition = location.getPosition(); |
| | | } |
| | | |
| | | /** |
| | | * 初始化播放器 |
| | | */ |
| | | private void initPlayer() { |
| | | fl_ad.setVisibility(View.GONE); |
| | | iv_select_play.setVisibility(View.VISIBLE); |
| | | iv_background.setVisibility(View.VISIBLE); |
| | | fl_video_play_background.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // Hide the status bar隐藏状态栏 |
| | | //测试 不做全屏 |
| | | // WindowManager.LayoutParams attrs = getWindow().getAttributes(); |
| | | // attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; |
| | | // getWindow().setAttributes(attrs); |
| | | WindowManager.LayoutParams attrs = getWindow().getAttributes(); |
| | | attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; |
| | | getWindow().setAttributes(attrs); |
| | | |
| | | Fragment videoDetailFragment = getSupportFragmentManager() |
| | | .findFragmentByTag("VideoDetailFragment"); |
| | |
| | | }.getType()); |
| | | PlayUrl info = new PlayUrl(); |
| | | info.setResource(resource); |
| | | info.setPlayType(Integer.parseInt(jsonObject |
| | | .getJSONObject("Data") |
| | | .optString("PlayType"))); |
| | | info.setUrl(jsonObject.getJSONObject("Data") |
| | | JSONObject data = jsonObject |
| | | .getJSONObject("Data"); |
| | | info.setPlayType(Integer.parseInt( |
| | | data.optString("PlayType"))); |
| | | info.setUrl(data |
| | | .optString("Url")); |
| | | info.setParams(jsonObject.getJSONObject("Data") |
| | | info.setParams(data |
| | | .optString("Params")); |
| | | info.setAid(data.optString("Aid")); |
| | | info.setVid(data.optString("Vid")); |
| | | playUrl = info; |
| | | if (videoInfo == null) { |
| | | return; |
| | | } |
| | | fl_ad.setVisibility(View.VISIBLE); |
| | | |
| | | if (!isSetup || isClick) { |
| | | fl_ad.setVisibility(View.VISIBLE); |
| | | startPlay(); |
| | | isClick = false; |
| | | } |