if (!isPlaying)
{
isPlaying = true;
mp = new MediaPlayer();
try {
mp.reset(); // new one
mp.setDataSource(AudioPlayer.this, myUri);
//mp.prepareAsync();
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp.prepare(); // don't use prepareAsync for mp3 playback
mp.start();
// String songTitle = songsList.get(songIndex).get("songTitle");
// songTitleLabel.setText(songTitle);
songProgressBar.setProgress(0);
songProgressBar.setMax(100);
// Updating progress bar
updateProgressBar();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
else
{
isPlaying = false;
mp.release();// stop Playing
//mp = null;
}
I have use it in my MediaPlayer it is working .. there is no need to download it..