title: Development of an audio player. How to stop updating seekbar notification (Mediastyle) when manipulating it by the user
body: <p>I'm developing an audio player, creating a Notification in Mediastyle style, with play, pause and seekbar buttons. The seekbar is updated once every half a second, taking the value from the current position of the media player. And everything works fine until the user independently starts rewinding the seekbar.</p>
  <p>When the user moves the slider, a callback is triggered:</p>
  <pre><code>MediaSession.setCallback(new MediaSessionCompat.Callback() {
          @Override
          public void onSeekTo(long pos) {
              mediaPlayer.seekTo((int)position);
          }
  </code></pre>
  <p>But due to the fact that the seekbar is updated every half a second, the user cannot move the seekbar slider indefinitely.
  Question: How can I stop updating the seekbar reading while it is being manipulated by the user. I know that seekbar has callbacks:</p>
  <pre><code>private boolean isTouch;
  public void setSeekbar(SeekBar seekBarPlayer) {
      seekBarPlayer.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
          @Override
          public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
              
          }
  
          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {
              isTouch = true;
          }
  
          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {
              isTouch = false;
          }
      });
  }
  </code></pre>
  <p>But I can't intercept them since I don't have a reference to the current seekbar to override the callbacks.</p>