I'm using MediaPlayer to play online track.But i got the problem:
try {
mMediaPlayer.reset();
mMediaPlayer.setDataSource(path);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setOnPreparedListener(preparedlistener);
mMediaPlayer.prepareAsync();
} catch (IOException ex) {
log.e(TAG, "IOException in setDataSourceAsync : path = " + path);
} catch (IllegalArgumentException ex) {
log.e(TAG, "IllegalArgumentException in setDataSourceAsync : path = " + path);
return;
}
While preparing the first track(after prepareAsync() before onPrepared()), I try to play the second track,ANR got when called mMediaPlayer.reset(), and change to call the mMediaPlayer.release() but still ANR. So how can i stop the MediaPlayer's preparing without ANR? Somebody help. Thanks!