title: Media Player Show video
body: <p>Why doesn't the MediaPlayer show the video as soon as it is available. What I mean is on the IPhone when a video is played the video shows up right away. Even when returning from pause. But on the Android the screen stays black for a couple of milliseconds to a second depending on the device used and how many processes are running in the background.</p>
  
  <p>I'm asking this because i want to use one of the beginning frames from my video play as a type of screenshot and currently I'm using a handler to wait 1 second before pausing the video.</p>
  
  <p>Can someone tell me a quick way to make the video show up as soon as it is started or even prepared instead of my workaround?</p>
  
  <p>EDIT:
  Here is how I prepare my video player so It should be prepared right.</p>
  
  <pre><code>private void initVideo() 
  {
      Log.i("VideoPlayer", "Initialize Video File" + videoFileName);
  
      AssetFileDescriptor afd;
      try {
          if(videoFileName != null);
          {
  
              afd = getAssets().openFd(videoFileName);
  
              vidplayer = new MediaPlayer();
  
              vidplayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getDeclaredLength());
  
              vidplayer.setDisplay(holder);
              vidplayer.prepare();
              vidplayer.setOnCompletionListener(this);
              vidplayer.setOnPreparedListener(this);  
              //Log.i("INITVIDEO", Integer.toString(videoPausedAt));
              vidplayer.seekTo(videoPausedAt);
              //Log.i("VideoPlayer", "video Prepared");
  
              videoDuration = vidplayer.getDuration()/1000;
  
  
              isVideoReady = true;
  
          }
  
      } catch (IllegalArgumentException e) {
          e.printStackTrace();
      } catch (IllegalStateException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      } catch (Exception e)
      {
          //Log.i("InitPlayer", e.getClass().toString());
          e.printStackTrace();
      }
  
  
  }
  </code></pre>