How to remove the black screen that appears before playing mp4 video?

I play MP4 on an Android phone with the code below:

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 was playing this video, before starting this video I saw one black screen for 0.2 or 0.3 seconds.

I do not need a black screen.

So why do I need to do this? I want that while I play on video, there should only be a video screen, no other black screen should be there before playing it?

Thanks.

+6
source share
1 answer

My solution to this problem was the following line:

 videoView.setZOrderOnTop(true); 

It changes the black screen with instant transparent video. You can easily fix this problem by installing ImageView with the first video frame behind VideoView.

+13
source

Source: https://habr.com/ru/post/906816/


All Articles