MP3 doesn't play when I press stream <p>I am trying to play a MP3 from a stream but the issue is after I press play it would automatically play. Also the play button doesn't play the audio it just sets it to stream. How can I make my MP3 automatically play?</p> <pre><code> play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (!mediaPlayer.isPlaying()) { try { mediaPlayer.setDataSource(url); mediaPlayer.prepareAsync(); } catch (Exception e) { e.printStackTrace(); } mediaFileLengthInMilliseconds = mediaPlayer.getDuration(); if(!mediaPlayer.isPlaying()){ mediaPlayer.start(); play.setImageResource(R.drawable.ic_media_pause); }else { mediaPlayer.pause(); play.setImageResource(R.drawable.ic_media_play); } primarySeekBarProgressUpdater(); } }}); sb.setMax(99); sb.setOnTouchListener(this); mediaPlayer = new MediaPlayer(); mediaPlayer.setOnBufferingUpdateListener(this); mediaPlayer.setOnCompletionListener(this); } private void primarySeekBarProgressUpdater() { sb.setProgress((int)(((float)mediaPlayer.getCurrentPosition()/mediaFileLengthInMilliseconds)*100)); if (mediaPlayer.isPlaying()) { notification = new Runnable() { public void run() { primarySeekBarProgressUpdater(); } }; handler.postDelayed(notification,1000); } } public boolean onTouch(View v, MotionEvent event) { if(v.getId() == R.id.progress_bar){ /** Seekbar onTouch event handler. Method which seeks MediaPlayer to seekBar primary progress position*/ if(mediaPlayer.isPlaying()){ SeekBar sb = (SeekBar)v; int playPositionInMillisecconds = (mediaFileLengthInMilliseconds / 100) * sb.getProgress(); mediaPlayer.seekTo(playPositionInMillisecconds); } } return false; } public void onCompletion(MediaPlayer mp) { play.setImageResource(R.drawable.ic_media_play); mediaPlayer.stop(); } public void onBufferingUpdate(MediaPlayer mp, int percent) { sb.setSecondaryProgress(percent); } } </code></pre> <p>Am I doing anything wrong? I click play and I see my seekbar filling up but it wont play. </p> <p>I also get this message:</p> <pre><code>E/MediaPlayer(28985): stop called in state 0 E/MediaPlayer(28985): error (-38, 0) E/MediaPlayer(28985): Error (-38,0) E/MediaPlayer(28985): stop called in state 0 E/MediaPlayer(28985): error (-38, 0) E/MediaPlayer(28985): Error (-38,0) E/MediaPlayer(28985): stop called in state 0 E/MediaPlayer(28985): error (-38, 0) E/MediaPlayer(28985): Error (-38,0) E/MediaPlayer(28985): stop called in state 0 E/MediaPlayer(28985): error (-38, 0) E/MediaPlayer(28985): Error (-38,0) E/MediaPlayer(28985): stop called in state 0 E/MediaPlayer(28985): error (-38, 0) E/MediaPlayer(28985): Error (-38,0) E/MediaPlayer(28985): stop called in state 0 E/MediaPlayer(28985): error (-38, 0) E/MediaPlayer(28985): Error (-38,0) </code></pre>