Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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.