Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Video Synchronization between VideoPlayer and Animations.

Discussion in 'Audio & Video' started by danielesuppo, Mar 19, 2018.

  1. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    173
    Hello!
    I'm working on a game in which a video should be perfectly syncronized with a 3D animation (from 3ds max).
    This video can change playback speed and the animation should be always syncronized.
    Well, everything is fine, but when I play the video very slow (let's say at speed 0.1) the animation update sooner (or later, I can't understand) than the frame of the video. So there's always a small gap between the frame and animation.
    Obviously that's the same with speed 1x, but is much less noticeable.
    The video is 30fps, so I've tried to put the Animation in FixedUpdate (with time step 0.0333), but the result is the same.
    So, I really can't understand when the video Update, or to better explain, when the picture is showed inside the Update loop, so to try to have the animation and the video showed in the same time...
    Maybe someone can give me an advice on it?
    Many thanks!

    P.S. The animation.time is get directly from the videoplayer.frame, so it's not an issue of time syncronization, but just of visual update... I hope to be clear
     
  2. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    173
    SOLVED: I've used the event frameReady to call the method for play Animation.
    Despite the manual it seem not to overload the cpu...
     
  3. morfevss

    morfevss

    Joined:
    Feb 2, 2018
    Posts:
    2
    Ciao Daniele, Could you tell me how you did it? I need to control both a video and an animation with a slider (so one can go fast forward or backwards) Thanks a lot.
     
  4. nicg220

    nicg220

    Joined:
    Nov 25, 2019
    Posts:
    3
    Sorry to bring this older post back, but this is also an issue I'm currently facing and would be curious to see if anyone might have some insight into how best to approach this problem?
     
unityunity