Code example for MediaMetadataRetriever

Methods: getFrameAtTimereleasesetDataSource

        return createThumbnail(uri, bitmap, orientation);
    public static Bitmap createVideoThumbnail(FileDescriptor fd, int targetWidth) {
        return createVideoThumbnail(null, fd, targetWidth);
    public static Bitmap createVideoThumbnail(String filePath, int targetWidth) {
        return createVideoThumbnail(filePath, null, targetWidth);
    private static Bitmap createVideoThumbnail(String filePath, FileDescriptor fd, int targetWidth) {
        Bitmap bitmap = null;
        MediaMetadataRetriever retriever = new MediaMetadataRetriever();
        try { 
            if (filePath != null) {
            } else { 
            bitmap = retriever.getFrameAtTime(-1);
        } catch (IllegalArgumentException ex) {
            // Assume this is a corrupt video file 
        } catch (RuntimeException ex) {
            // Assume this is a corrupt video file. 
Connect your IDE to all the code out there  Get Codota for Java