Search Unity

Noob: playing videos using timeline

Discussion in 'Timeline' started by EduBroseta, Mar 19, 2019.

  1. EduBroseta

    EduBroseta

    Joined:
    Feb 10, 2019
    Posts:
    5
    I want to play a video on a timline that is triggered programatically. I am using the activation track to play the videoplayer object containing the video clip.

    It works well if i have both the video player and the timeline set to Play on awake, since the timeline starts precisely at runtime, so the videoplayer is already deactivated and starts playback when the cursor gets to the activation clip.

    But i just dont want the video to start at the beginning, but only after something happens. If i untick the Play on awake option on the timeline, then the video starts right away after runtime, wich is something i dont want, and disappears when the Timeline starts playing, thus deactivating the object.

    Am i just wrong with this approach?

    Thanks!
     
    slf126 likes this.
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Make sure the video player is deactivated in the scene without timeline active. It sounds like the game object with the video is active when going into playmode.

    The activation track won't change it's default state (you can toggle 'preview' off in the timeline to see the default state of the object).
     
  3. EduBroseta

    EduBroseta

    Joined:
    Feb 10, 2019
    Posts:
    5
    Yes! That was it, many thanks! :)

    Now another related question, i see there´s a bit of lag when the timeline cursor plays the video (doesnt start right away, should start earlier). I read this could be improved with videoplayer.prepare. My plan is to add several videos on the same timeline. Would it make sense to prepare them all when going into playmode or is this gonna have a great impact in cpu/memory? Otherwise, can i prepare them via clips on the timeline? Or what would be the best solution?
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    A custom clip to prepare them ahead of time and play them would distribute the load a bit better.
     
  5. Gruntled

    Gruntled

    Joined:
    May 11, 2020
    Posts:
    4
    What version of Unity are these instructions for? I am having a similar issue as OP in Unity 2019 but did not see those options you described. Is there a tutorial for setting this up properly? I was not able to find any with google search.
    Thank you!