本文共 489 字,大约阅读时间需要 1 分钟。
- public Bitmap getVideoThumbnail(String filePath) {
- Bitmap bitmap = null;
- MediaMetadataRetriever retriever = new MediaMetadataRetriever();
- try {
- retriever.setDataSource(filePath);
- bitmap = retriever.getFrameAtTime();
- }
- catch(IllegalArgumentException e) {
- e.printStackTrace();
- }
- catch (RuntimeException e) {
- e.printStackTrace();
- }
- finally {
- try {
- retriever.release();
- }
- catch (RuntimeException e) {
- e.printStackTrace();
- }
- }
- return bitmap;
- }
转载于:https://www.cnblogs.com/qwer520/p/4904089.html