title: Android - Where to implement onBufferingUpdate(...) using VideoView and MediaController
body: <p>I am confused by the <code>MediaController</code> and <code>VideoView</code> APIs in Android.</p>
  
  <p>I am using it to stream videos through HTTP, which is working fine. Only problem is that it stops for buffering from time to time. I now want to get notified whenever the video starts to buffer to display a progress indicator.</p>
  
  <p>I learned that I need to implement <code>public abstract void onBufferingUpdate (MediaPlayer mp, int percent)</code> from <code>android.media.MediaPlayer.OnBufferingUpdateListener</code>, my question is just <em>where do I have to implement it</em>? I followed the advice from another SO question and implemented:</p>
  
  <pre><code>    videoView.setOnPreparedListener(new OnPreparedListener() {
          @Override
          public void onPrepared(MediaPlayer mp) {
              Log.d(Constants.LOG, "onPrepared called");
  
              mp.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {
                  @Override
                  public void onBufferingUpdate(MediaPlayer mp, int percent) {
                  //do something
                      Log.d(Constants.LOG, "Buffering update: " +  percent + "%");
  
                  }
              });
          }
  </code></pre>
  
  <p>But it didn't work... Do I have to subclass <code>VideoView</code> and implement it there??</p>