title: Detect if a VideoVIew is buffering
body: <p>Does anyone know if it's possible to detect when a VideoView is buffering?</p>
  
  <p>I want to show a ProgressDialog when the video is buffering.</p>
  
  <p>So far I tried using a OnPreparedListener, but that only works when the video is first loaded. If a video is playing and the user moves the scrub bar to a different point the video is still "prepared" even though it is buffering.</p>
  
  <p>I also tried (I know this is awful) an AsyncThread that just busy waits on isPlaying():</p>
  
  <pre><code>private class BufferTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
    protected Void doInBackground(Void...voids) {
      final VideoView videoView = (VideoView)findViewById(R.id.video);
      while (!videoView.isPlaying()) { }
      return null;
    }
  
   protected void onPostExecute(Void v) {
       // Hide the dialog here...
   }
  }
  </code></pre>
  
  <p>This doesn't work because as soon as you call start() a VideoView seems to be considered playing even though it is buffering.</p>
  
  <p>The only solution I can think of is building a custom VideoView type class so I can access its MediaPlayer instance.</p>
  
  <p>Any ideas? Thanks for reading.</p>