Commit ea073404 authored by Han Ruisong's avatar Han Ruisong
Browse files

升级到v3.7.2

1. 新增自动切换线路功能。
2. 优化Demo功能。
parent 6d470060
No preview for this file type
No preview for this file type
......@@ -33,13 +33,13 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//获得场景视频SDK,必须引入
implementation 'com.bokecc:vod:3.7.1'
implementation 'com.bokecc:vod:3.7.2'
//必须引用commonLib
implementation 'com.bokecc:commonLib:0.1.9'
//必须引用
implementation 'com.bokecc:drm:1.2.0'
//使用DWIjkMediaPlayer 倍速播放器引入
implementation 'com.bokecc:speedplay:2.19.3'
implementation 'com.bokecc:hdplayer:1.1.0_lite'
//上传视频时使用压缩功能时需要引用
implementation 'com.bokecc:compressvideo:1.0.0'
//使用Vr播放功能时需要引入
......
......@@ -16,6 +16,7 @@ import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.bokecc.sdk.mobile.util.HttpUtil;
import com.bokecc.vod.adapter.PlayVideoAdapter;
import com.bokecc.vod.data.DataSet;
import com.bokecc.vod.data.DataUtil;
......@@ -64,7 +65,6 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
MultiUtils.setStatusBarColor(this, R.color.transparent, true);
initView();
//初始化数据库和下载数据 没有开通授权播放和下载功能的账号 verificationCode可为空值
verificationCode = MultiUtils.getVerificationCode();
DownloadController.init(verificationCode);
......
package com.bokecc.vod.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.bokecc.sdk.mobile.download.Downloader;
import com.bokecc.vod.R;
import com.bokecc.vod.download.DownloadWrapper;
import com.bokecc.vod.utils.MultiUtils;
import java.util.List;
public class DownloadViewAdapter extends BaseAdapter{
private List<DownloadWrapper> downloadInfos;
private Context context;
public DownloadViewAdapter(Context context, List<DownloadWrapper> downloadInfos){
this.context = context;
this.downloadInfos = downloadInfos;
}
@Override
public int getCount() {
return downloadInfos.size();
}
@Override
public Object getItem(int position) {
return downloadInfos.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
DownloadWrapper wrapper = downloadInfos.get(position);
ViewHolder holder = null;
if (convertView == null) {
convertView = View.inflate(context, R.layout.item_downloading, null);
TextView titleView = convertView.findViewById(R.id.download_title);
TextView statusView = convertView.findViewById(R.id.download_status);
TextView speedView = convertView.findViewById(R.id.download_speed);
ImageView iv_video_cover = convertView.findViewById(R.id.iv_video_cover);
TextView progressView = convertView.findViewById(R.id.download_progress);
ProgressBar downloadProgressBar = convertView.findViewById(R.id.download_progressBar);
downloadProgressBar.setMax(100);
holder = new ViewHolder();
holder.downloadProgressBar = downloadProgressBar;
holder.progressView = progressView;
holder.speedView = speedView;
holder.statusView = statusView;
holder.titleView = titleView;
holder.iv_video_cover = iv_video_cover;
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.titleView.setText(wrapper.getDownloadInfo().getTitle());
holder.statusView.setText(getStatusStr(wrapper.getStatus()) + "");
MultiUtils.showVideoCover(holder.iv_video_cover,wrapper.getDownloadInfo().getVideoCover());
if (wrapper.getStatus() == Downloader.DOWNLOAD) {
holder.speedView.setText(wrapper.getSpeed(context));
holder.progressView.setText(wrapper.getDownloadProgressText(context));
holder.downloadProgressBar.setProgress((int)wrapper.getDownloadProgressBarValue());
} else {
holder.speedView.setText("");
holder.progressView.setText(wrapper.getDownloadProgressText(context));
holder.downloadProgressBar.setProgress((int)wrapper.getDownloadProgressBarValue());
}
return convertView;
}
private String getStatusStr(int status) {
String statusStr = null;
switch (status) {
case Downloader.WAIT:
statusStr = "等待中";
break;
case Downloader.DOWNLOAD:
statusStr = "下载中";
break;
case Downloader.PAUSE:
statusStr = "已暂停";
break;
case Downloader.FINISH:
statusStr = "已完成";
break;
}
return statusStr;
}
public class ViewHolder {
public TextView titleView;
public ImageView iv_video_cover;
public TextView statusView;
public TextView speedView;
public TextView progressView;
public ProgressBar downloadProgressBar;
}
}
package com.bokecc.vod.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.bokecc.sdk.mobile.download.Downloader;
import com.bokecc.vod.R;
import com.bokecc.vod.download.DownloadWrapper;
import com.bokecc.vod.utils.MultiUtils;
import java.util.List;
public class DownloadViewAdapter extends BaseAdapter{
private List<DownloadWrapper> downloadInfos;
private Context context;
public DownloadViewAdapter(Context context, List<DownloadWrapper> downloadInfos){
this.context = context;
this.downloadInfos = downloadInfos;
}
@Override
public int getCount() {
return downloadInfos.size();
}
@Override
public Object getItem(int position) {
return downloadInfos.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
DownloadWrapper wrapper = downloadInfos.get(position);
ViewHolder holder = null;
if (convertView == null) {
convertView = View.inflate(context, R.layout.item_downloading, null);
TextView titleView = convertView.findViewById(R.id.download_title);
TextView statusView = convertView.findViewById(R.id.download_status);
TextView speedView = convertView.findViewById(R.id.download_speed);
ImageView iv_video_cover = convertView.findViewById(R.id.iv_video_cover);
TextView progressView = convertView.findViewById(R.id.download_progress);
ProgressBar downloadProgressBar = convertView.findViewById(R.id.download_progressBar);
downloadProgressBar.setMax(100);
holder = new ViewHolder();
holder.downloadProgressBar = downloadProgressBar;
holder.progressView = progressView;
holder.speedView = speedView;
holder.statusView = statusView;
holder.titleView = titleView;
holder.iv_video_cover = iv_video_cover;
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.titleView.setText(wrapper.getDownloadInfo().getTitle());
holder.statusView.setText(getStatusStr(wrapper.getStatus()) + "");
MultiUtils.showVideoCover(holder.iv_video_cover,wrapper.getDownloadInfo().getVideoCover());
if (wrapper.getStatus() == Downloader.DOWNLOAD) {
holder.speedView.setText(wrapper.getSpeed(context));
holder.progressView.setText(wrapper.getDownloadProgressText(context));
holder.downloadProgressBar.setProgress((int)wrapper.getDownloadProgressBarValue());
} else {
holder.speedView.setText("");
holder.progressView.setText(wrapper.getDownloadProgressText(context));
holder.downloadProgressBar.setProgress((int)wrapper.getDownloadProgressBarValue());
}
return convertView;
}
private String getStatusStr(int status) {
String statusStr = null;
switch (status) {
case Downloader.WAIT:
statusStr = "等待中";
break;
case Downloader.DOWNLOAD:
statusStr = "下载中";
break;
case Downloader.PAUSE:
statusStr = "已暂停";
break;
case Downloader.FINISH:
statusStr = "已完成";
break;
}
return statusStr;
}
public class ViewHolder {
public TextView titleView;
public ImageView iv_video_cover;
public TextView statusView;
public TextView speedView;
public TextView progressView;
public ProgressBar downloadProgressBar;
}
}
package com.bokecc.vod.adapter;
import android.content.Context;
import android.text.format.Formatter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.bokecc.vod.R;
import com.bokecc.vod.download.DownloadWrapper;
import com.bokecc.vod.utils.MultiUtils;
import java.util.List;
public class DownloadedViewAdapter extends BaseAdapter{
private List<DownloadWrapper> downloadInfos;
private Context context;
public DownloadedViewAdapter(Context context, List<DownloadWrapper> downloadInfos){
this.context = context;
this.downloadInfos = downloadInfos;
}
@Override
public int getCount() {
return downloadInfos.size();
}
@Override
public Object getItem(int position) {
return downloadInfos.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
DownloadWrapper wrapper = downloadInfos.get(position);
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = View.inflate(context, R.layout.item_downloaded_video, null);
holder.tv_filesize = convertView.findViewById(R.id.tv_filesize);
holder.titleView = convertView.findViewById(R.id.downloaded_title);
holder.iv_video_cover = convertView.findViewById(R.id.iv_video_cover);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.titleView.setText(wrapper.getDownloadInfo().getTitle());
long end = wrapper.getDownloadInfo().getEnd();
if (end>0){
holder.tv_filesize.setVisibility(View.VISIBLE);
holder.tv_filesize.setText(Formatter.formatFileSize(context, wrapper.getDownloadInfo().getEnd()));
}else {
holder.tv_filesize.setVisibility(View.INVISIBLE);
}
MultiUtils.showVideoCover(holder.iv_video_cover,wrapper.getDownloadInfo().getVideoCover());
return convertView;
}
public class ViewHolder {
public TextView titleView;
public TextView tv_filesize;
public ImageView iv_video_cover;
}
}
package com.bokecc.vod.adapter;
import android.content.Context;
import android.text.format.Formatter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.bokecc.vod.R;
import com.bokecc.vod.download.DownloadWrapper;
import com.bokecc.vod.utils.MultiUtils;
import java.util.List;
public class DownloadedViewAdapter extends BaseAdapter{
private List<DownloadWrapper> downloadInfos;
private Context context;
public DownloadedViewAdapter(Context context, List<DownloadWrapper> downloadInfos){
this.context = context;
this.downloadInfos = downloadInfos;
}
@Override
public int getCount() {
return downloadInfos.size();
}
@Override
public Object getItem(int position) {
return downloadInfos.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
DownloadWrapper wrapper = downloadInfos.get(position);
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = View.inflate(context, R.layout.item_downloaded_video, null);
holder.tv_filesize = convertView.findViewById(R.id.tv_filesize);
holder.titleView = convertView.findViewById(R.id.downloaded_title);
holder.iv_video_cover = convertView.findViewById(R.id.iv_video_cover);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.titleView.setText(wrapper.getDownloadInfo().getTitle());
long end = wrapper.getDownloadInfo().getEnd();
if (end>0){
holder.tv_filesize.setVisibility(View.VISIBLE);
holder.tv_filesize.setText(Formatter.formatFileSize(context, wrapper.getDownloadInfo().getEnd()));
}else {
holder.tv_filesize.setVisibility(View.INVISIBLE);
}
MultiUtils.showVideoCover(holder.iv_video_cover,wrapper.getDownloadInfo().getVideoCover());
return convertView;
}
public class ViewHolder {
public TextView titleView;
public TextView tv_filesize;
public ImageView iv_video_cover;
}
}
......@@ -73,7 +73,7 @@ public class PlayListAdapter extends BaseAdapter {
if (videoInfo.isSelected()){
holder.tv_video_title.setTextColor(context.getResources().getColor(R.color.orange));
}else {
holder.tv_video_title.setTextColor(context.getResources().getColor(R.color.black));
holder.tv_video_title.setTextColor(context.getResources().getColor(R.color.videoTitle));
}
}
return convertView;
......
package com.bokecc.vod.adapter;
import android.content.Context;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.bokecc.vod.R;
import com.bokecc.vod.download.DownloadWrapper;
import com.bokecc.vod.upload.UploadWrapper;
import com.bokecc.vod.utils.MultiUtils;
import java.io.File;
import java.util.List;
public class UploadDoneAdapter extends BaseAdapter{
private List<UploadWrapper> uploadInfos;
private Context context;
public UploadDoneAdapter(Context context, List<UploadWrapper> uploadInfos){
this.context = context;
this.uploadInfos = uploadInfos;
}
@Override
public int getCount() {
return uploadInfos.size();
}
@Override
public Object getItem(int position) {
return uploadInfos.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
UploadWrapper wrapper = uploadInfos.get(position);
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = View.inflate(context, R.layout.item_upload_done, null);
holder.tv_filesize = convertView.findViewById(R.id.tv_filesize);
holder.tv_upload_title = convertView.findViewById(R.id.tv_upload_title);
holder.iv_video_cover = convertView.findViewById(R.id.iv_video_cover);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.tv_upload_title.setText(wrapper.getUploadInfo().getTitle());
holder.tv_filesize.setText(Formatter.formatFileSize(context, wrapper.getUploadInfo().getEnd()));
String videoCoverPath = wrapper.getUploadInfo().getVideoCoverPath();
if (!TextUtils.isEmpty(videoCoverPath)){
MultiUtils.showCornerVideoCover(holder.iv_video_cover,videoCoverPath);
}else {
holder.iv_video_cover.setImageResource(R.mipmap.iv_default_img);
}
return convertView;
}
public class ViewHolder {
public TextView tv_upload_title;
public TextView tv_filesize;
public ImageView iv_video_cover;
}
}
package com.bokecc.vod.adapter;
import android.content.Context;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.bokecc.vod.R;
import com.bokecc.vod.download.DownloadWrapper;
import com.bokecc.vod.upload.UploadWrapper;
import com.bokecc.vod.utils.MultiUtils;
import java.io.File;
import java.util.List;
public class UploadDoneAdapter extends BaseAdapter{
private List<UploadWrapper> uploadInfos;
private Context context;
public UploadDoneAdapter(Context context, List<UploadWrapper> uploadInfos){
this.context = context;
this.uploadInfos = uploadInfos;
}
@Override
public int getCount() {
return uploadInfos.size();
}
@Override
public Object getItem(int position) {
return uploadInfos.get(position);
}
@Override
public long getItemId(int position) {