I have used this example for retrieving frames of video . Is there any way to get the frames of video continuously but this is not an appropriate example. https://github.com/rubensousa/PreviewSeekBar
I have used this example for retrieving frames of video . Is there any way to get the frames of video continuously but this is not an appropriate example. https://github.com/rubensousa/PreviewSeekBar
This method should do the trick:
public static Bitmap getVideoFrame(Context context, Uri uri, long time) {
Bitmap bitmap = null;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource(context, uri);
bitmap = retriever.getFrameAtTime(time);
} catch (RuntimeException ex) {
ex.printStackTrace();
} finally {
try {
retriever.release();
} catch (RuntimeException ex) {
ex.printStackTrace();
}
}
return bitmap;
}
Hope this help.
According to the answer of orimen.
exoPlayer.setVideoFrameMetadataListener((presentationTimeUs, releaseTimeNs, format, mediaFormat) -> currentFrame = getVideoFrame(getContext(), Uri.parse(data.path), presentationTimeUs));