It seems that a -38 error means a condition exception (as indicated by the error message). For example, if you call start() before the song is ready, or when you call pause() , even if the song does not play at all.
To resolve this issue, check the status of mediaPlayer before calling the methods. For example:
if(mediaPlayer.isPlaying()) { mediaPlayer.pause(); }
In addition, MediaPlayer sends event messages. Even if you do not need a prepared event (although it would be nice not to start playing before this event has been triggered), you should set up a listener callback. This is also true for OnErrorListener , OnCompletionListener , OnPreparedListener and OnSeekCompletedListener (if you call the search method).
Listeners can be attached simply
mediaPlayer.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) {
Alexander Pacha Jan 14 '13 at 15:42 2013-01-14 15:42
source share