Monday, 25 March 2019

Get duration of audio file Android

I have a ListView with several audio files. For each one I have to get the duration in order to display it in the list.

This is what I have tried yet:

MediaPlayer getDuration() -> takes about 1 sec for 13 items

MediaStore and Cursor -> takes about 2 sec for 13 items

This is way too much for displaying the ListView.

So I have thought of this:

creating a database with file-names and duration when recording the audio files

-> this leads to a data inconsistency, because files could have been deleted

Is there a alternative way to achieve this?

Thanks in advance



from Get duration of audio file Android

No comments:

Post a Comment