SergioM SergioM - 1 year ago 175
Android Question

Android VideoView black screen

I have been looking for a way to get rid of the nasty black initial screen on a VideoView before the start() method is run.

I have tried with background image on the widget but it doesnt work as expected at all.
I have also tried putting an image of the first frame in the video on top of the VideoView and hiding it after the stars() method.
Adding an onPrepared listener to start the video and then hide the image. This works but there is a horrible flicker in the transition and i don't know how to get rid of it.

Thanks for your reply. Adding the MediaController had no effect at all. The problem persists (I still see the black flicker) and I dont want to have the video controls visible at all.
My code looks like this:

VideoView vSurface= (VideoView) findViewById(;
vSurface.setVideoURI(Uri.parse("android.resource://com.mypackage/" + R.raw.video1));

Answer Source

I got the same problem and i found a solution. Its a little bit hacky but it do the trick. So basically you need to put your VideoView into a FrameLayout. Over the videoview you need to add another FrameLayout with the background of your video and when your video is loaded and ready to play you hide the placeholder.

  android:layout_marginTop="50dip" >

    android:layout_height="172dip" android:layout_gravity="top|center" android:visibility="visible"/>

      android:layout_height="fill_parent" android:background="@drawable/fondvert_anim">

In your activity you need to implements OnPreparedListener and add this

//Called when the video is ready to play
public void onPrepared(MediaPlayer mp) {

    View placeholder = (View) findViewById(;


So when the video is ready we hide our placeholder and that trick avoid the black flicker screen.

Hope this help someone.