2

I use glide to get frame from video url but glide for get frame, download the whole video and it takes time.

        RequestOptions myOptions = new RequestOptions()
            .fitCenter()
            .centerCrop().circleCrop()
            .placeholder(R.drawable.loading_circle);

       Glide.with(context)
            .asBitmap()
            .apply(myOptions)
            .load(Link)
            .into(image);

How can I get the last frame from the video?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Hossin Asaadi
  • 367
  • 6
  • 13
  • check this ans https://stackoverflow.com/questions/22954894/is-it-possible-to-generate-a-thumbnail-from-a-video-url-in-android – AskNilesh Aug 23 '17 at 07:47

2 Answers2

5

you can use MediaMetadataRetriever for doing that , you can also use url , code sample from here ,

.....

String url = "yoururl";

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  ImageView capturedImageView = (ImageView)findViewById(R.id.capturedimage);

  MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();

  mediaMetadataRetriever .setDataSource(url, new HashMap<String, String>());
  Bitmap bmFrame = mediaMetadataRetriever.getFrameAtTime(1000); //unit in microsecond
  capturedImageView.setImageBitmap(bmFrame);
 }
Omar Dhanish
  • 885
  • 7
  • 18
0

See if this helps you need this api to first fetch the frame separately and then use the glide How to get video thumbnail (frame) from live video url

Umar Hussain
  • 3,461
  • 1
  • 16
  • 38