title: Android - MediaPlayer's on Prepare Called even before the stream is prepared on Android 4.0+
body: <p>I am facing the issue that whenever a stream is played by my app on Android 4.0+ the <code>OnPrepare</code> method from <code>MediaPlayer.OnPreparedListener</code> is called even before a stream is loaded and thus i am unable to indicated the user that the stream downloading/buffering is in process. <a href="https://stackoverflow.com/questions/12538013/android-4-0-4-mediaplayer-prepare-issue-using-rtsp-urls">I have already found a question of the same kind but not answered</a>
   Here is a what i am doing.</p>
  
  <pre><code>   @Override
      public void onCreate(final Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);  
          playVideo(someRtspUrl);
      }
      private void playVideo(String url) {
          // if app is running on Google TV then change RTSP link to HLS
          if (url.contains("rtsp")) {
  
              // split the RTSP URL and make it as HLS
              String videoUrlParts[] = url.split("\\?");
              url = videoUrlParts[0].replace("rtsp", "http") + "/playlist.m3u8";
  
              if (videoUrlParts.length &gt; 1)
                  url += "?" + videoUrlParts[1];
          }   mVideoView.setVideoURI(Uri.parse(url));
          mVideoView.requestFocus();
          mVideoView.setOnCompletionListener(this);
          mVideoView.setOnPreparedListener(this); 
  
      }
  
  
  
      @Override
          public void onPrepared(MediaPlayer player) {
              dismissProgressDialog();
              mVideoView.start();
          }
  </code></pre>
  
  <p><strong>This Code is Working fine on Google TV and other Android 3.0+ and &lt; 4.0+ device</strong> </p>