Search Unity

Video Playing video during loading of scene

Discussion in 'Audio & Video' started by fmarianacci, Mar 26, 2020.

  1. fmarianacci

    fmarianacci

    Joined:
    Oct 15, 2018
    Posts:
    20
    Hello,

    I add a video player in my loading screen. Then I can play some video in load time to distract the user.

    But when a scene is loading, even if I load it async, the video freeze and skip frame...

    I think a way to avoid that behavior is to play the video in an other thread ? But I don't know how to do it. Anyone had and idea ?
     
  2. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi!

    What you are describing is a fairly reasonable workflow, but the current graphics design in Unity forces texture updates to happen from the main thread. Video decoding is already happening on other threads (job system or in threads owned by the OS libraries doing the decoding), but scheduling the refresh of the drawing that includes the latest video frame still has to happen from the main thread, which means the game loop must still run at a stable rate. So if the scene loading happens to use too much of the main thread (or too much of the background threads), then the video playback will be interrupted as you are describing.

    Async scene loading is meant to help with what you are doing, so it would be interesting to see, via profiler, what is causing the hiccups. You can either investigate this yourself (and maybe find and fix this on your end) or submit a bug with a possibly simplified scene that reproduces the problem and we can see if anything can be improved on our end.

    Thanks for letting us know about this; hope this can be improved!

    Dominique Leroux
    A/V developer at Unity
     
  3. eonyanov

    eonyanov

    Joined:
    Oct 6, 2014
    Posts:
    21
    Did you solve this problem?
     
  4. eonyanov

    eonyanov

    Joined:
    Oct 6, 2014
    Posts:
    21
    And how to create 10 second buffer for the Video File in Unity?
     
    NaChen519 likes this.