We had the same issue in one of our project, removing
setAudioStreamType
solved it, however we only needed to play small mp3 files.
here is the code from the project
public class AsyncCdnAccess extends AsyncTask<Configuration,boolean[],boolean[]>{
private MediaPlayer player;
@Override
protected boolean[] doInBackground(Configuration... args){
boolean[] result=new boolean[args.length];
for(int i=0;i<args.length;i++){
result[i]=feedback&& playRemote(args[].word);
}
}
public void setupPlayer() {
this.player = new MediaPlayer();
this.player.setVolume(1.0F, 1.0F);
this.player.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer arg0) {
stop();
}
});
}
public boolean playRemote(String word) {
stop();
synchronized (this) {
setupPlayer();
String path = getRequestRemote(this.currentCdn, word);
this.player.setDataSource(path);
this.player.prepare();
this.player.start();
isPlaying = true;
return true;
}
}
public void stop() {
if (!isPlaying)
return;
synchronized (this) {
this.player.stop();
this.player.release();
isPlaying = false;
}
}
}
we tested the application with these Samsung devices
Galaxy S
Galaxy S3
Galaxy S4
Galaxy Note
Galaxy Note2
Galaxy Tab
Galaxy Tab 2 7.0
Galaxy Tab 2 10.1
hope this helps