Android 节操视频播放器jiecaovideoplayer自定义播放音频使用:屏蔽全屏按钮,增加倒计时,当前时间/总时间
生活随笔
收集整理的這篇文章主要介紹了
Android 节操视频播放器jiecaovideoplayer自定义播放音频使用:屏蔽全屏按钮,增加倒计时,当前时间/总时间
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
一、屏蔽全屏按鈕
找到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);
?
二、自動檢測,增加倒計(jì)時,當(dāng)前時間/總時間
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 進(jìn)度欄// <editor-fold defaultstate="collapsed" desc="自動調(diào)整播放工具欄,沒有進(jìn)度條:00:01/06:00,沒有進(jìn)度條也沒有當(dāng)前時間顯示倒計(jì)時 05:59">if (progressBar.getVisibility() != View.VISIBLE) {//沒有進(jìn)度條((LinearLayout) bottomContainer).setGravity(Gravity.END | Gravity.CENTER_VERTICAL);progressBar.setVisibility(View.GONE);totalTimeTextView.setText(" / " + JCUtils.stringForTime(totalTime));if (currentTimeTextView.getVisibility() != View.VISIBLE) {//沒有當(dāng)前播放進(jìn)度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="自動調(diào)整播放工具欄,沒有進(jìn)度條:00:01/06:00,沒有進(jìn)度條也沒有當(dāng)前時間顯示倒計(jì)時 05:59">if (progressBar.getVisibility() != View.VISIBLE) {//沒有進(jìn)度條((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) {//沒有當(dāng)前播放進(jìn)度totalTimeTextView.setText(JCUtils.stringForTime(totalTime - currentTime));}}// </editor-fold>}如果調(diào)用時只設(shè)置了隱藏了 progressBar:
mJcAudioPlayerStandard.progressBar.setVisibility(View.INVISIBLE);顯示效果如下圖:“00:02/06:20”?當(dāng)前時間/總時間
如果調(diào)用時設(shè)置了隱藏了 progressBar,同時隱藏了currentTimeTextView:
mJcAudioPlayerStandard.progressBar.setVisibility(View.INVISIBLE); mJcAudioPlayerStandard.currentTimeTextView.setVisibility(View.INVISIBLE);顯示效果如下:“06:18”為時間倒計(jì)時。
總結(jié)
以上是生活随笔為你收集整理的Android 节操视频播放器jiecaovideoplayer自定义播放音频使用:屏蔽全屏按钮,增加倒计时,当前时间/总时间的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js中null,undefined,fa
- 下一篇: data类型的Url的格式