Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Video Videos don't start immediately

Discussion in 'Audio & Video' started by Pietrofonix, May 25, 2023.

  1. Pietrofonix

    Pietrofonix

    Joined:
    Aug 1, 2020
    Posts:
    54
    Hi guys, I have a problem with the video player. Basically the videos don't start immediately but before they start there is for an instant a frame of the scene. I tried using the functions videoPlayer.Prepare and renderTexture.Release but nothing changes. Do you know how can I solve this?
     
    Last edited: May 25, 2023
  2. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    When you call Play, the video will parse the file, request access to a decoder and send frames to the decoder. Nothing will happen during that lapse of time between calling Play() and seeing the video. So if your RenderTexture had something else in it, you would see it. Prepare() should help with that, but you must give it time. Calling Prepare() and Play() will not make it faster. You need to prepare the video before you need it so that it is instant when you need it.