Home » Android » android – How to remove the black screen that apper before playing the mp4 Video?

android – How to remove the black screen that apper before playing the mp4 Video?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am playing the MP4 in android phone with the below code:

VideoView videoView = (VideoView) findViewById(R.id.VideoView);
        //  Set video link (mp4 format )
        File file2 = new File("/sdcard/Alone.mp4");
        Uri video = Uri.fromFile(file2);

        videoView.setVideoURI(video);
        videoView.start();

But while i playing this video, before starting of that video i seen one black screen for 0.2 or 0.3 second.

I dont want that black screen to appear.

So for that what should i have to do ?
I want is, while i play the video, there should be only screen of the video, no any other black screen should be there before playing it ?

Thanks.

How to&Answers:

My solution to this problem was this line:

videoView.setZOrderOnTop(true);

This changes the black screen with a momentary transparent video. You can easily fix this other issue by setting an ImageView with the first video frame behind the VideoView.