Always get java.lang.IllegalStateException: mediaMetadataRetriever.e…ETADATA_KEY_VIDEO_HEIGHT) must not be null
See original GitHub issueI use light compressor to compress video right after completing it’s recording.
Before starting light compressor, I export the video with this code:
final ContentValues values = new ContentValues(5);
// The number 5 above, refer to these 5 lines
values.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4");
values.put(MediaStore.Video.Media.DATA, filePath);
values.put(MediaStore.Video.Media.DURATION, videoDuration);
values.put(MediaStore.Video.Media.HEIGHT, videoHeight);
values.put(MediaStore.Video.Media.WIDTH, videoWidth);
Uri uri = context.getContentResolver().insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
values);
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
I have added MediaStore.Video.MEDIA.HEIGHT value, but why the exception state that it’s null? Is it because the different value?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
android - MediaMetadataRetriever setDataSource throws ...
I was getting the same error, I am using android 10. I solved just putting android:requestLegacyExternalStorage ...
Read more >MediaMetadataRetriever - Android Developers
This method is similar to getFrameAtIndex(int, android.media.MediaMetadataRetriever.BitmapParams) except that the default for BitmapParams will be used.
Read more >MediaMetadataRetriever.java - android Git repositories
import java.util.Map;. /**. * MediaMetadataRetriever class provides a unified interface for retrieving. * frame and meta data from an input media file.
Read more >MediaMetadataRetriever.setDataSource(String path) no ...
if(retriever != null) { try { retriever. ... IllegalArgumentException from the setDataSource() call. 07-31 13:04:56.908: W/System.err(16770): java.lang.
Read more >android.media.MediaMetadataRetriever.setDataSource java ...
public MediaMetadataRetriever getMediaMetadataRetriever(String url) { if (mCoverMedia == null) { mCoverMedia = new MediaMetadataRetriever(); } mCoverMedia.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please try version 0.6.2 and close the issue if everything is ok
Yes sure, I will handle this and will notify you when it’s done. Thank you a lot 😄