Media Player called in state 0, error (-38,0)

The Solution to Media Player called in state 0, error (-38,0) is


You need to call mediaPlayer.start() in the onPrepared method by using a listener. You are getting this error because you are calling mediaPlayer.start() before it has reached the prepared state.

Here is how you can do it :

mp.setDataSource(url); 
mp.setOnPreparedListener(this);
mp.prepareAsync();

public void onPrepared(MediaPlayer player) {
    player.start();
}

~ Answered on 2012-07-18 11:39:44


Most Viewed Questions: