一、屏蔽全屏按鈕
找到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文件中的代碼:
@Overrideprotected 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);}
修改為:
@Overrideprotected 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 進度欄// <editor-fold defaultstate="collapsed" desc="自動調整播放工具欄,沒有進度條:00:01/06:00,沒有進度條也沒有當前時間顯示倒計時 05:59">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));}}// </editor-fold>}
1、找到JCVideoPlayerStandard.java文件中的代碼:
@Overrideprotected void resetProgressAndTime() {super.resetProgressAndTime();bottomProgressBar.setProgress(0);bottomProgressBar.setSecondaryProgress(0);}
修改為:
@Overrideprotected void resetProgressAndTime() {super.resetProgressAndTime();bottomProgressBar.setProgress(0);bottomProgressBar.setSecondaryProgress(0);// <editor-fold defaultstate="collapsed" desc="自動調整播放工具欄,沒有進度條:00:01/06:00,沒有進度條也沒有當前時間顯示倒計時 05:59">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));}}// </editor-fold>}
如果調用時只設置了隱藏了 progressBar:
mJcAudioPlayerStandard.progressBar.setVisibility(View.INVISIBLE);
顯示效果如下圖:“00:02/06:20”?當前時間/總時間
如果調用時設置了隱藏了 progressBar,同時隱藏了currentTimeTextView:
mJcAudioPlayerStandard.progressBar.setVisibility(View.INVISIBLE);
mJcAudioPlayerStandard.currentTimeTextView.setVisibility(View.INVISIBLE);
顯示效果如下:“06:18”為時間倒計時。