title: How can I use SeekBar's OnSeekBarChangeListener to seek to a specific point in a MediaPlayer object?
body: <p>I have some Android code to stream an audio file from the internet and play the stream after 10 seconds.</p>
  
  <p>I am using a SeekBar to view the buffering status and playing status. I want to play the audio starting from the middle of the buffered stream. For that, I move the SeekBar point to the middle, but I cannot play the audio from the middle; it will go back and start from the beginning. How can I get the seeked position and how can I play the audio from that particular position?</p>
  
  <p>Here is my SeekBar code. How can I make this code use the OnSeekBarChangeListener properly?</p>
  
  <pre><code>seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
  
      @Override
      public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {
          // TODO Auto-generated method stub
          if (arg2 &amp;&amp; mediaPlayer.isPlaying()) {
              //myProgress = oprogress;
              arg1=mediaPlayer.getCurrentPosition();
              mediaPlayer.seekTo(arg1);
          }
      }
  
      @Override
      public void onStartTrackingTouch(SeekBar seekBar) {
          // TODO Auto-generated method stub
      }
  
      @Override
      public void onStopTrackingTouch(SeekBar seekBar) {
          // TODO Auto-generated method stub
      }
  
  });
  </code></pre>