Created
July 3, 2019 07:14
-
-
Save yccheok/b45a62ea77b4f7310b6a868dbe25eb66 to your computer and use it in GitHub Desktop.
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
| Uri uri = Uri.fromFile(destination); | |
| MediaMetadataRetriever mmr = new MediaMetadataRetriever(); | |
| mmr.setDataSource(WeNoteApplication.instance(), uri); | |
| String durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); | |
| long length = 0L; | |
| try { | |
| length = Long.parseLong(durationStr); | |
| } catch (NumberFormatException e) { | |
| Log.e(TAG, "", e); | |
| } | |
| if (length <= 0L) { | |
| return null; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment