博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android 节操视频播放器jiecaovideoplayer自定义播放音频使用:屏蔽全屏按钮,增加倒计时,当前时间/总时间
阅读量:2230 次
发布时间:2019-05-09

本文共 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/

你可能感兴趣的文章
【托业】【新东方托业全真模拟】TEST07~08-----P5~6
查看>>
solver及其配置
查看>>
JAVA多线程之volatile 与 synchronized 的比较
查看>>
Java集合框架知识梳理
查看>>
笔试题(一)—— java基础
查看>>
Redis学习笔记(三)—— 使用redis客户端连接windows和linux下的redis并解决无法连接redis的问题
查看>>
Intellij IDEA使用(一)—— 安装Intellij IDEA(ideaIU-2017.2.3)并完成Intellij IDEA的简单配置
查看>>
Intellij IDEA使用(二)—— 在Intellij IDEA中配置JDK(SDK)
查看>>
Intellij IDEA使用(三)——在Intellij IDEA中配置Tomcat服务器
查看>>
Intellij IDEA使用(四)—— 使用Intellij IDEA创建静态的web(HTML)项目
查看>>
Intellij IDEA使用(五)—— Intellij IDEA在使用中的一些其他常用功能或常用配置收集
查看>>
Intellij IDEA使用(六)—— 使用Intellij IDEA创建Java项目并配置jar包
查看>>
Eclipse使用(十)—— 使用Eclipse创建简单的Maven Java项目
查看>>
Eclipse使用(十一)—— 使用Eclipse创建简单的Maven JavaWeb项目
查看>>
Intellij IDEA使用(十三)—— 在Intellij IDEA中配置Maven
查看>>
面试题 —— 关于main方法的十个面试题
查看>>
集成测试(一)—— 使用PHP页面请求Spring项目的Java接口数据
查看>>
使用Maven构建的简单的单模块SSM项目
查看>>
Intellij IDEA使用(十四)—— 在IDEA中创建包(package)的问题
查看>>
FastDFS集群架构配置搭建(转载)
查看>>