Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question [Solved] Video Player. Video flicker/blink on android just right before video starts

Discussion in 'Editor & General Support' started by urba777, Oct 22, 2022.

  1. urba777

    urba777

    Joined:
    Mar 14, 2022
    Posts:
    2
    Hey guys,

    This is the first time I ask someone for help in this forum. Hope I'll get your help :)

    Well, the issue is that, when scene loads, I start mp4 video with Unity's Video Player. I use Raw Image and RenderTexture with it. In editor and Bluestacks emulator everything is fine, but when I start the game on android, just right before the video starts - I get black screen for ~1sec as you can see in the video (1.53s and 6.19s) . There're two "blinks" because I am playing two videos one after another. And every time it happens right before the video starts. Does anyone know how to fix this? I would greatly appreciate.



    I am new with Video Player and don't understand what could be wrong. I assigned textures in my code.
    upload_2022-10-22_12-35-15.png

    Code:

    Code (CSharp):
    1. void Start()
    2.     {
    3.         renderTextureFirstVideo = new CustomRenderTexture(1080, 1920);
    4.         renderTextureFirstVideo.initializationColor = new Color(0f, 0f, 0f, 0f);
    5.  
    6.         renderTextureLoopVideo = new CustomRenderTexture(1080, 1920);
    7.         renderTextureLoopVideo.initializationColor = new Color(0f, 0f, 0f, 0f);
    8.  
    9.         time = _FirstVideo.clip.length;
    10.         Timing.RunCoroutine(IShowVideo());
    11.     }
    12.  
    13.     private IEnumerator<float> IShowVideo()
    14.     {
    15.         yield return Timing.WaitForSeconds(1f);
    16.         _FirstVideoRawImage.texture = renderTextureFirstVideo;
    17.         _FirstVideo.targetTexture = _FirstVideoRawImage.texture as RenderTexture;
    18.         _FirstVideo.gameObject.SetActive(true);
    19.         _FirstVideo.Play();
    20.  
    21.         yield return Timing.WaitForSeconds((float)time);
    22.  
    23.         _LoopVideoRawImage.texture = renderTextureLoopVideo;
    24.         _LoopVideo.targetTexture = _LoopVideoRawImage.texture as RenderTexture;
    25.         _LoopVideo.gameObject.SetActive(true);
    26.         _LoopVideo.Play();
    27.     }
    Thank you.
     
    Last edited: Oct 22, 2022
  2. urba777

    urba777

    Joined:
    Mar 14, 2022
    Posts:
    2
    Solved. I made RawImage color (255f, 255f, 255f, 0f) for ~0.5f seconds to make it invisible in IEnumerator and then made it visible again. Now it looks good :))