获取指定目录的视频文件:
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()) {