Android Utililty Methods Video Thumbnail Create

List of utility methods to do Video Thumbnail Create

Description

The list of methods to do Video Thumbnail Create are organized into topic(s).

Method

BitmapcreateVideoThumbnail(String filePath)
create Video Thumbnail
Class<?> clazz = null;
Object instance = null;
try {
    clazz = Class.forName("android.media.MediaMetadataRetriever");
    instance = clazz.newInstance();
    Method method = clazz.getMethod("setDataSource", String.class);
    method.invoke(instance, filePath);
    if (Build.VERSION.SDK_INT <= 9) {
...
BitmapgetVideoThumbnail(String videoPath, int width, int height, int kind)
get Video Thumbnail
try {
    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;
...
BitmapgetVideoThumbnail(String videoPath, int width, int height, int kind)
get Video Thumbnail
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;
BitmapcreateVideoThumbnail(String imagePath, int kind)
Create a video thumbnail for a video.
Bitmap bitmap = null;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
   retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY);
   retriever.setDataSource(filePath);
   bitmap = retriever.captureFrame();
} catch (IllegalArgumentException ex) {
} catch (RuntimeException ex) {
 ...
BitmapcreateVideoThumbnail(String filePath, int size)
create Video Thumbnail
Bitmap bitmap = null;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
    retriever.setDataSource(filePath);
    bitmap = retriever.getFrameAtTime(-1);
} catch (IllegalArgumentException ex) {
    ex.printStackTrace();
} catch (RuntimeException ex) {
...