-
-
Save mohanrajsambath/3100d8efde3d8bbe41ee8848d3593bec to your computer and use it in GitHub Desktop.
MediaMetadataReteriver in Android api-30 returns null
This file contains 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
private void getMediaDuration(String filePathforPlayback){ | |
MediaMetadataRetriever retriever = new MediaMetadataRetriever(); | |
try { | |
retriever.setDataSource(getActivityContext, Uri.fromFile(new File(filePathforPlayback))); | |
String fileDuration = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); | |
Log.i("MyActivity", "fileDuration---=>" + fileDuration); | |
retriever.release(); | |
}catch (Exception ex){ex.printStackTrace();}finally { | |
retriever=null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment