Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Always get java.lang.IllegalStateException: mediaMetadataRetriever.e…ETADATA_KEY_VIDEO_HEIGHT) must not be null

See original GitHub issue

I 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,
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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

AbedElazizShecommented, Aug 2, 2020

Please try version 0.6.2 and close the issue if everything is ok

AbedElazizShecommented, Aug 2, 2020

Yes sure, I will handle this and will notify you when it’s done. Thank you a lot 😄

Read more comments on GitHub >

github_iconTop 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, except that the default for BitmapParams will be used.
Read more > - 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 > java ...
public MediaMetadataRetriever getMediaMetadataRetriever(String url) { if (mCoverMedia == null) { mCoverMedia = new MediaMetadataRetriever(); } mCoverMedia.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found