- Home /
working with mp4 files when supporting both Standalone and iOS builds
Basically I'm asking the same thing as this user posted: http://answers.unity3d.com/questions/1096180/how-to-use-video-files-twice-once-as-resources-and.html#comment-1143145
I have a project which supports both Standalone PC/OSX builds as well as iOS builds. I'm using a third-party package to support rendering a movie to a texture for iOS, which has the requirement that the assets are in the StreamingAssets folder. For the Standalone build, I want to simply use a MovieTexture format, however for this to work I keep my MP4 file in the Resources folder and use Resources.Load.
I tried having a copy of my mp4 files in both places, but iOS won't compile as it's complaining about not supporting MovieTextures, despite the fact that I'm not referencing the files anywhere, they just sit in the Resources folder. Even if that did work, requiring two copies of each mp4 movie seems like a poor workaround. I've tried using the WWW class, but wasn't having any luck with the MovieTexture format, it just wouldn't load the video.
What's everyone else doing to support video's across Standalone and mobile (iOS in my case)?
Answer by mdespault · Feb 23, 2016 at 02:29 PM
It seems like the best way to handle this particular situation is to use AssetBundles.
I take the version of the mp4 file that Unity converts to a "MovieTexture" on import for PC/OSX builds, and the regular unconverted mp4 file (non MovieTexture, inside StreamingAssets folder). I create an AssetBundle containing both versions of the movie, and place that bundle in the StreamingAssets folder. This way, I can load the proper version of the mp4 file and circumvent the compile errors you normaly get for having a MovieTexture file anywhere when building for iOS.
If I wanted to keep the movie files on a server somewhere, I could simply use a WWW request to stream in the appropriate AssetBundle, eliminating the need to have two different versions of the same movie files.
Your answer
Follow this Question
Related Questions
Movie texture not playing in standalone build 1 Answer
HandHeld video compression setting doesn't work in editor? 1 Answer
How to dynamically change a movie texture from Streaming Assets for a windows build 0 Answers
Accessing external asset bundles from local iOS files. 1 Answer
iOS Streaming Assets inaccessible 0 Answers