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

Play video files from hard drive.

Discussion in 'Scripting' started by pollyox16, Oct 28, 2014.

  1. pollyox16

    pollyox16

    Joined:
    Feb 7, 2014
    Posts:
    13
    Hi. Im wondering if there is any way to play a video you select from you hard drive in runtime using unity3d pro.

    Any solution to this would be very apreciated.
     
  2. MysterySoftware

    MysterySoftware

    Joined:
    Sep 18, 2014
    Posts:
    46
    Try using WWW.
    Code (CSharp):
    1. public MovieTexture movie;
    2.  
    3. public IEnumerator GetVideo {
    4. movie = new www("file://FILEPATH").movie;
    5. while (!texture.isReadyToPlay)
    6. yield return null;
    7.  
    8. // Some code to sync the video to the texture
    9. }
    You can read more about this in the Unity Script Reference.
    http://docs.unity3d.com/ScriptReference/WWW-movie.html
     
    Last edited: Nov 1, 2014
    pollyox16 likes this.
  3. pollyox16

    pollyox16

    Joined:
    Feb 7, 2014
    Posts:
    13
    thank you very much. ill take a look.