Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Video Change video clip in runtime

Discussion in 'Audio & Video' started by Venominus, Dec 16, 2017.

  1. Venominus

    Venominus

    Joined:
    Sep 5, 2015
    Posts:
    25
    When I change video clip and play next there is a 1 second gap when there is visible nothing. How to change video clips fluently.
     
  2. averyrodriguez

    averyrodriguez

    Joined:
    Dec 20, 2017
    Posts:
    3
    I liked it, very interesting
     
  3. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    288
    I did it creating a general player that can play several videos (listed in an array in the inspector, for example).

    Each video is prepared to be played in its own plane (no fullscreen here, that doesn't work for me). The plane has exactly the same ratio proportions of the video (16:9, 16:10, 4:3, etc...) and fills all the screen.

    All videos in the list are created with that planes and "prepared" (using the Unity's prepare function = important).

    When a video is playing, it's plane renderer become enabled and I call a video "Play" function.
    When a video Stops I deactivate its own plane (and call video.Stop()) and start to play the next (enabling its plane renderer) in that secuence.

    That's it. It works fine without any gaps.

    In fullscreen (camera near, camera far) doesnt work. (At least for me I get sometimes a black screen).

    Videos are in h264 (mp4). Baseline (or Main) , Lvl 3.0 or Lvl 3.1 at most. Using HD videos on mobile can crate gaps while playing using this system.

    Hope it helps!