How to fix "setDataSource failed: status = 0x80000000" error in java on android

0

I am writing a music player for android and I am trying to get the duration of the songs (without a FileDiscriptor --> just with the path of the File) I am showing to sort them. But i get this exception when trying it:

java.lang.RuntimeException: setDataSource failed: status = 0x80000000

int column_index = songCursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
String songPath = songCursor.getString(column_index);

Uri u = Uri.parse(songPath);
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(getActivity().getApplicationContext() ,u);
String durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
int millSecond = Integer.parseInt(durationStr);
long dur = Long.parseLong("" + millSecond);
java
android
asked on Stack Overflow Jul 15, 2019 by Lukas Gaebler • edited Jul 16, 2019 by Lukas Gaebler

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0