Play .flac file using MediaPlayer class in android

You can post your problem related to Computer Software Projects here. We will try our best to help you out.
Post Reply
Robert
Posts: 31
Joined: Sat Feb 18, 2017 7:21 am

Play .flac file using MediaPlayer class in android

Post by Robert » Thu Mar 09, 2017 8:50 am

I am using the following code successfully on Lollipop. But it is not working on Marshmellow.

Code: Select all

for (int i = 0; i < all_track_size; i++) {
    SongDetailModel model = new SongDetailModel();
    String path = SharedPreferenceUtil.getString("all_track_path" + i, "");
    model.setSong_path(path);
    array_all_track.add(model);
}

if (array_all_track.get(pos).getSong_path().endsWith(".mp3") ||
        array_all_track.get(pos).getSong_path().endsWith(".flac") ||
        array_all_track.get(pos).getSong_path().endsWith(".wav")) {

    filePath = array_all_track.get(pos).getSong_path();
    Log.d(TAG, " : SELECTED SONG : " + filePath);
}

Post Reply