I want to integrate my app with a MediaPlayer, but I can't play music that are in the internal storage. Actually I have only 1 song in the "Music" folder. I can't play it. This is my code:
Uri uri = MediaStore.Audio.Media.INTERNAL_CONTENT_URI;
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC;
try {
mediaPlayer.setDataSource(this, uri);
mediaPlayer.prepare();
} catch (IOException e) {
e.printStackTrace();
}
mediaPlayer.start();