Android 视频播放器总结,面试心得体会

本文介绍了Android中如何获取和管理视频文件,包括从指定目录获取视频、获取照片,以及展示删除和锁定对话框的实现,是Android移动开发中关于视频播放器和文件管理的面试心得总结。
摘要由CSDN通过智能技术生成

这里写图片描述

获取指定目录的视频文件:

public static ArrayList getVideos(ContentResolver cr,

boolean isFront, boolean isLock) {

ArrayList arrayListVideo = new ArrayList();

File dirMedia;

if (!isFront) { // 后录视频

dirMedia = new File(isLock ? Constant.Path.VIDEO_BAC

《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》

【docs.qq.com/doc/DSkNLaERkbnFoS0ZF】 完整内容开源分享

K_LOCK
Constant.Path.VIDEO_BACK_UNLOCK);

} else { // 前录视频

dirMedia = new File(isLock ? Constant.Path.VIDEO_FRONT_LOCK
Constant.Path.VIDEO_FRONT_UNLOCK);

}

try {

if (dirMedia.exists()) {

File[] childFiles = dirMedia.listFiles();

for (File childFile : childFiles) {

String fileName = childFile.getName();

if (!fileName.startsWith(".") && fileName.endsWith(".mp4")

&& childFile.exists()) {

MultiGridItem item = new MultiGridItem();

item.path = childFile.getPath();

item.isVideo = true;

item.displayName = childFile.getName();

String thumbnailPath = Constant.Path.VIDEO_THUMBNAIL

  • fileName.replace(".mp4", “.jpg”);

if (new File(thumbnailPath).exists()) {

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值