Android Video Thumbnail Create getVideoThumbnail(String videoPath, int width, int height, int kind)

Here you can find the source of getVideoThumbnail(String videoPath, int width, int height, int kind)

Description

get Video Thumbnail

Declaration

public static Bitmap getVideoThumbnail(String videoPath, int width,
        int height, int kind) 

Method Source Code

//package com.java2s;
import android.graphics.Bitmap;
import android.media.ThumbnailUtils;

public class Main {

    public static Bitmap getVideoThumbnail(String videoPath, int width,
            int height, int kind) {
        try {/*from  ww  w  .  j a  va  2s. c  o  m*/
            Bitmap bitmap = null;
            bitmap = ThumbnailUtils.createVideoThumbnail(videoPath, kind);
            System.out.println("w" + bitmap.getWidth());
            System.out.println("h" + bitmap.getHeight());
            bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height,
                    ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
            return bitmap;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. createVideoThumbnail(String filePath)
  2. getVideoThumbnail(String videoPath, int width, int height, int kind)
  3. createVideoThumbnail(String imagePath, int kind)
  4. createVideoThumbnail(String filePath, int size)