Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Pause/Stop a video at a certain frame before playing

Discussion in 'Scripting' started by saifshk17, Jun 26, 2018.

  1. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    485
    Hello,

    I would like to pause a video at frame 1 before actually playing it. Since the video remains blank and I dont want it to be that way. Any solutions?

    Code (CSharp):
    1. public VideoPlayer movie;
    2. public VideoClip DefaultClip;
    3.  
    4. void Start()
    5.     {
    6.         movie = GetComponent<VideoPlayer>();
    7.         movie.clip = DefaultClip;
    8.         movie.Play();
    9.         }
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
  3. LudwigVRtualX

    LudwigVRtualX

    Joined:
    Oct 15, 2018
    Posts:
    11
    Hey, I also would like the videoplayer to show a certain frame before playback. Brathnanns solution (videoplayer.frame) does not actually display the chosen frame. It just sets the frame as the starting frame for video playback as soon as playback starts. The player remains black before playback.

    Any Ideas?
     
  4. mikolaj_kubiak

    mikolaj_kubiak

    Joined:
    Jun 23, 2020
    Posts:
    3
    Hey, run into the same problem. Somebody maybe succeed at that? Or some valuable insights?
     
  5. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    485
    As soon as the application begins, you can start a coroutine for 1 sec, Play video and then Pause it. This is how I did it.