I have some problem with VideoPlayer. In editor everything looks good, but when I run application on Android device, before play video a black screen appears for a very short time
Facing same issue in Unity 2021.3.12
If you are using a RenderTexture, check that the RenderTexture is clear before showing it. Otherwise, can you check if the first frame of your clip is black? If you click on your video and play the preview, you shouldn’t see any black frames.
Hi, same issue here.
My videos don’t have any black frame.
Tried to clear the RenderTexture before Play():
public void PlayVideo()
{
ClearRenderTexture();
videoPlayer.Play();
}
private void ClearRenderTexture()
{
RenderTexture rt = RenderTexture.active;
RenderTexture.active = videoPlayer.targetTexture;
GL.Clear(true, true, Color.clear);
RenderTexture.active = rt;
}
Also tried clearing on Start().
I’m thinking about doing some trick with, so maybe somehow I can load the first frame preemptively…
videoPlayer.Play();
videoPlayer.Stop();
Don’t do Play() Stop(). If you want, you can Play() Pause() instead. Maybe try another colour like red to see if it shows like expected. If you don’t see any difference, perhaps there is an issue elsewhere.
Same issue, don’t know how to remove this black screen
private void ClearRenderTexture()
{
RenderTexture rt = RenderTexture.active;
RenderTexture.active = videoPlayer.targetTexture;
GL.Clear(true, true, Color.clear);
RenderTexture.active = rt;
}
This code should work. I would check if the targetTexture is not null and what you expect. Maybe you are not clearing the RenderTexture you are showing, but another one.
I am also experiencing an issue in Unity 6 with the Video Player sending its output to a camera’s far plane. Clip changes result in a frame or more of not rendering the video, resulting in the camera showing the default camera background (be it sky, color or none).
This may be a slightly different issue that what is reported here, but there is definitely an issue of new clips needing a few frames before anything renders. I may have to have a prepared Video Player for each clip. Which is not ideal, it would be nice if I could queue up the next clip in the one player and have it immediately be ready.
We’re having what I think is the same issue on Android. Sometimes when we play a video the whole screen goes black but the game is still interactable.
We’re using Unity 2023.2.20f. Our video player is set to use a render texture and the audio is setup to use an audio source. We have tried a lot of things.
Has any found a workaround for this? We have just disabled the videos on Android for now.