- Home /
EasyMovieTexture: is possible to load movie files from Application.persistentDataPath ?
Is this possible at all?
I'd assume so but I can't get any videos from the persistent data path to playback on Android.
I am basically doing the following:
download an mp4 from the inter webs.
save it to internal storage, like so:
byte[] data = // data that I just downloaded...; string fileName = "video.mp4"; string path = Application.persistentDataPath + "/videos/" + fileName; File.WriteAllBytes (path, data);
The above means in android I end up with a full path like:
/data/user/0/com.myCompany.myApp/files/videos/video.mp4
Then I try to load the video with EasyMovieTexture, like so:
scrMedia.Load (path);
scrMedia.m_bLoop = true;
scrMedia.Play ();
But the video does not load.
if instead I directly put the video in StreamingAssets before building, the above code loads the video just fine. So I assume it is either an Android path issue or an EasyMovieTexture issue (i.e. it only loads from StreamingAssets folder). But I'm not sure as of now.
Anyone has any clues?
Thanks!
Answer by saldavonschwartz · Jul 29, 2016 at 04:58 AM
Amateur mistake... I had forgotten the file://
prefix when specifying paths in Android.
scrMedia.Load ("file://" + path);
I am also trying for the same downloading and loading solution using the same plugin .. would it be possible for you to share the code on how to download and play the video. I am stuck at this .. would be of great help to me