Search Unity

Question Performance of Video Player Prepare, how to reliably start videos quickly?

Discussion in 'Audio & Video' started by AFriendlyUnityDeveloper, Dec 1, 2023.

  1. AFriendlyUnityDeveloper

    AFriendlyUnityDeveloper

    Joined:
    Dec 26, 2018
    Posts:
    33
    I have a use case where I have hundreds of small (256x256) and short (no more than 5 seconds) videos that I need to be able to play with minimal latency in my game.

    Here are the problems I am aware of with doing this on Unity:
    1) Video player needs time to prepare every video before playing first, its not clear how long this should take. The documentation seems to imply it won't be fast though.
    2) Preparing/seeking a video happens on the main thread, thus causing the rest of the game to hang while this happens.

    Is it possible to get this working in unity in a way that is performant? I see a few possible options:
    1) Just do it and hope the performance isn't too terrible.
    2) Load hundreds of tiny videos and prepare them ahead of time.
    3) Have one giant video that concatenates all the small ones and just seek to each video when its time to play them. (is seeking performance any better than preparing? Its difficult to tell from the documentation)
    4) Use a third party video player. (although again, its not clear that any of them can guarantee anything better)

    Does anyone have experience with this sort of thing? How fast is this in general in Unity/is there a way to get better performance here?