简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM