This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void getThumbnail(int index, ResultCallback callback) { | |
| LoadBitmapAsyncTask task = new LoadBitmapAsyncTask(index, callback); | |
| task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); | |
| } | |
| class LoadBitmapAsyncTask extends AsyncTask<Void, Void, Bitmap> { | |
| final int mIndex; | |
| final ResultCallback mResultCallback; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void getThumbnail(int index, final ResultCallback callback) { | |
| // Step 1. Get position from the index. | |
| long position = getSeekPositions()[index]; | |
| // Step 2. Retrieve thumbnail in the background to not block the UI thread. | |
| retrieveThumbnailForPosition(position, index, (bitmap) -> { | |
| // Step 3. Return the thumbnail to be presented in the UI. | |
| callback.onThumbnailLoaded(bitmap, index); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PlaybackSeekMetadataDataProvider extends PlaybackSeekDataProvider { | |
| //… | |
| public PlaybackSeekMetadataDataProvider(Context context, | |
| String videoUrl, | |
| long interval) { | |
| mContext = context; | |
| mVideoUrl = videoUrl; | |
| MediaMetadataRetriever retriever = new MediaMetadataRetriever(); | |
| retriever.setDataSource(mVideoUrl, new HashMap<>()); |
NewerOlder