android-thumbnail

Android: How do I get thumbnail from a Video (Uri)

大城市里の小女人 提交于 2020-05-16 04:36:30
问题 I want thumbnail from a video at any specific position. I am using ThumbnailUtils in order to get thumbnail from video uri and assigning to bitmap but I am getting null value on bitmap. Any reasons how this is happening and how do I fix this? selectedVideoUri = data.getData(); bitmap = ThumbnailUtils.createVideoThumbnail(getRealPathFromURI(videoUri), MediaStore.Images.Thumbnails.MINI_KIND); public String getRealPathFromURI(Uri contentUri) { String res = null; String[] proj = { MediaStore

Get multiple thumbnails from video

百般思念 提交于 2019-12-22 04:30:49
问题 I'm using MediaMetadataRetriever to retrieve thumbnails at a specific time in video. This is how I achieve this: MediaMetadataRetriever metadataRetriever = new MediaMetadataRetriever(); try { metadataRetriever.setDataSource(MainActivity.this, Uri.parse("android.resource://packageName/raw/"+"test")); String duration=metadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); long time = Long.valueOf(duration)/3; Bitmap bitmap1 = metadataRetriever.getFrameAtTime(time

Android never call method onCreateThumbnail

点点圈 提交于 2019-12-13 20:22:13
问题 Based on Android documentation, method onCreateThumbnail is called before pausing the activity, and should draw into outBitmap the imagery for the desired thumbnail in the dimensions of that bitmap. It can use the given canvas , which is configured to draw into the bitmap, for rendering if desired. The default implementation returns fails and does not draw a thumbnail; this will result in the platform creating its own thumbnail if needed. When the method returns true , system will not use a