How to get frame of stream video link with Glide

Viewed 1308

in my android TV application, at start i want to show a frame of my each stream links. my current solution is using LoaderManager and the problem of this technique is to it's too slow(application crashed).

FFmpegMediaMetadataRetriever to load and set video stream link.
this.retriever = new FFmpegMediaMetadataRetriever();
Bitmap bitmap = null;
retriever.setDataSource(this.mSelectedStream.getStreamUrl());
bitmap = retriever.getFrameAtTime();
drawable = new BitmapDrawable(bitmap);
retriever.release();

i found this thread that explain that glide can used to load image from video links.

BitmapPool bitmapPool = Glide.get(getApplicationContext()).getBitmapPool();
                int microSecond = 6000000;// 6th second as an example
                VideoBitmapDecoder videoBitmapDecoder = new VideoBitmapDecoder(microSecond);
                FileDescriptorBitmapDecoder fileDescriptorBitmapDecoder = new FileDescriptorBitmapDecoder(videoBitmapDecoder, bitmapPool, DecodeFormat.PREFER_ARGB_8888);
                Glide.with(getApplicationContext())
                        .load(yourUri)
                        .asBitmap()
                        .override(50,50)// Example
                        .videoDecoder(fileDescriptorBitmapDecoder)
                        .into(yourImageView);

but when i used above code i get "cannot access from outside of package" error for VideoBitmapDecoder.

exmaple link = "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"

any idea? thanks

1 Answers
Related