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

1

9

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.

Leucoplast answered 25/1, 2012 at 6:2 Comment(1)
Possible duplicate of android-black screen on displaying video by using VideoViewLen
D
17

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.

Denny answered 4/5, 2012 at 11:0 Comment(2)
In my case, this property doesn't even display the video. I have to use setZOrderMediaOverlay, which overrides any previous call to setZOrderOnTop. If i use only setZOrderOnTop then the video doesn't show up, you only hear the audio, but it also prevents the black screen from appearingAlvinalvina
@Denny hey, just wanted to say thank you for your answer, I've been searching it for so long, and the only some what solution most people said was to take a photo over the video, but yours works great, thank you, up voted!Yetah

© 2022 - 2024 — McMap. All rights reserved.