posted by dalnimbest 2021. 9. 5. 10:09

Glide를 이용해서 mp4비디오 파일의 경우는 경로만 넘겨줘도 적당한 시간(?)에 있는 썸네일을 잘 받아온다.

하지만 mkv파일의 경우에는 파일경로만 줘서는 썸네일이 검은화면만 나와서 아래와 같이 RequestOptions에 원하는 시간대의 값을 options.frame에 넣어주면 된다. (본인의 경우 mp4는 options.frame설정을 안해줘도 적당한 시간대의 값을 가져오는데, mkv는 검은화면만 나왔다.)

 

 

    public static void getThumbnailVideoFile(Context context, ImageView imageView, String path) {
        RequestOptions options = new RequestOptions();
        options.frame(1000000); //원하는 시간대를 넣는다. 
        Glide.with(context)
                .load(path)
                .apply(options)
                .into(imageView);
    }