Hi,
I want the user to be able to choose an .ogv file from their hard drive and then play it in a MovieTexture on the GUI.
So far I've got working:
Being able to get the path of an .ogv file:
string path = EditorUtility.OpenFilePanel("Open Video Folder", "", "ogv");
if(path.Length > 0) {
WWW request = new WWW(path);
m_movieTex = (MovieTexture) request.movie; }
I've also got the OnGUI() function like so:
GUI.DrawTexture(new Rect(0, 0, 320, 240), m_movieTex);
m_movieTex.Play();
The problem is, nothing shows after the play function is called.
I've breakpointed on the Play() line to make sure it gets there, but then if I let the code carry on, nothing happens. There is just a black rectangle on the GUI.
Is there anything I'm doing wrong? Do I need to do some kind of loading of the file into memory rather than attempting to just run it straight away (like it's streaming)?
Thanks.
EDIT: By "not working" basically when the MovieTexture gets created, it has a duration of -1 and any call to .Play() does nothing (it doesn't set isPlaying to true).
↧