本文共 3199 字,大约阅读时间需要 10 分钟。
一、屏蔽全屏按钮
找到JCVideoPlayerStandard.java文件中的代码:
private void fixAudio() { if (SrcType.equalsIgnoreCase("Audio")) { //如果是音频,始终显示coverImageView //thumbImageView.setVisibility(View.VISIBLE); coverImageView.setVisibility(View.VISIBLE); bottomProgressBar.setVisibility(View.VISIBLE); fullscreenButton.setVisibility(View.INVISIBLE); } }
改为:fullscreenButton.setVisibility(View.GONE);
二、自动检测,增加倒计时,当前时间/总时间
1、找到JCVideoPlayerStandard.java文件中的代码:
@Override protected void setProgressAndTime(int progress, int secProgress, int currentTime, int totalTime) { super.setProgressAndTime(progress, secProgress, currentTime, totalTime); if (progress != 0) bottomProgressBar.setProgress(progress); if (secProgress != 0) bottomProgressBar.setSecondaryProgress(secProgress); }
修改为:
@Override protected void setProgressAndTime(int progress, int secProgress, int currentTime, int totalTime) { super.setProgressAndTime(progress, secProgress, currentTime, totalTime); if (progress != 0) bottomProgressBar.setProgress(progress); if (secProgress != 0) bottomProgressBar.setSecondaryProgress(secProgress); //zheng 2019.05.13 进度栏 //if (progressBar.getVisibility() != View.VISIBLE) {//没有进度条 ((LinearLayout) bottomContainer).setGravity(Gravity.END | Gravity.CENTER_VERTICAL); progressBar.setVisibility(View.GONE); totalTimeTextView.setText(" / " + JCUtils.stringForTime(totalTime)); if (currentTimeTextView.getVisibility() != View.VISIBLE) {//没有当前播放进度 totalTimeTextView.setText(JCUtils.stringForTime(totalTime - currentTime)); } } // }
1、找到JCVideoPlayerStandard.java文件中的代码:
@Override protected void resetProgressAndTime() { super.resetProgressAndTime(); bottomProgressBar.setProgress(0); bottomProgressBar.setSecondaryProgress(0); }
修改为:
@Override protected void resetProgressAndTime() { super.resetProgressAndTime(); bottomProgressBar.setProgress(0); bottomProgressBar.setSecondaryProgress(0); //if (progressBar.getVisibility() != View.VISIBLE) {//没有进度条 ((LinearLayout) bottomContainer).setGravity(Gravity.END | Gravity.CENTER_VERTICAL); progressBar.setVisibility(View.GONE); int currentTime = getCurrentPositionWhenPlaying(); int totalTime = getDuration(); totalTimeTextView.setText(" / " + JCUtils.stringForTime(totalTime)); if (currentTimeTextView.getVisibility() != View.VISIBLE) {//没有当前播放进度 totalTimeTextView.setText(JCUtils.stringForTime(totalTime - currentTime)); } } // }
如果调用时只设置了隐藏了 progressBar:
mJcAudioPlayerStandard.progressBar.setVisibility(View.INVISIBLE);
显示效果如下图:“00:02/06:20” 当前时间/总时间
如果调用时设置了隐藏了 progressBar,同时隐藏了currentTimeTextView:
mJcAudioPlayerStandard.progressBar.setVisibility(View.INVISIBLE);mJcAudioPlayerStandard.currentTimeTextView.setVisibility(View.INVISIBLE);
显示效果如下:“06:18”为时间倒计时。
转载地址:http://fmkbb.baihongyu.com/