Search Unity

Question Loading a VideoClip via Script

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

  1. Alastair567

    Alastair567

    Joined:
    May 9, 2015
    Posts:
    13
    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:
    502
    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.