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.

Question Loading a VideoClip via Script

Discussion in 'Audio & Video' started by Alastair567, Oct 18, 2022.

  1. Alastair567

    Alastair567

    Joined:
    May 9, 2015
    Posts:
    12
    I'm making an application where the user opens the filebrowser, clicks a video & then the video gets loaded to the VideoPlayer.
    To do this, however, I need to store the VideoClip that the user selects within the file browser.
    I'm having trouble with this however due to the fact that the file I select needs to be converted or initialised into a VideoClip & the file is registered (according to Unity) as a different type.
    Is there anyway of converting the type to a video clip?
     
  2. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    378
    VideoClip is only created in the Editor. To load the file at runtime, you can set the VideoPlayer URL to Application.streamingAssetsPath + "/" + fileName or whatever your file path and it will play the video.
     
    Alastair567 likes this.