- Home /
How to use video files twice: Once as Resources and once as StreamingAssets
I have a couple .mp4 videos which play fine on Standalone when loading them from Resources Folder via Resources.Load<MovieTexture>("videoname"). They also play fine on Mobile when loading from StreamingAssets folder via Handheld.PlayFullScreenMovie("videoname.ext").
Mobile does not support MovieTexture and Standalone does not support Handheld. So in Order for this to work on Standalone and Mobile, I would need to duplicate the video files which would result in having the same video files in both folders (Resources and StreamingAssets). This is redundant and I would like to avoid this.
Is there a simple solution for that? Can you somehow merge those folders or similar? Or maybe I can specify to ommit one or another folder when deploying for a certain platform?
I know you can not Resources.Load from StreamingAssets and you can not Handheld.PlayFullScreenMovie from Resources (one of both would solve this problem). I also know about loading videos from StreamingAssets via WWW class, but this only supports .ogvwhich in return is not supported by mobile.
Cheers, phineliner
P.S.: I know that there are Plugins like AVPro, but I'm a student and this is a university project, so I don't want to spend 200 bucks for a plugin ;)
edit:
In case I have the files duplicated (distributed to the two folders), I can not build for Mobile anymore: 'MovieTexture' is not supported when building for Android.. It's giving me this error because I have the imported video file inside of the Resources folder. Can I somehow tell to ignore the videos of the resources folder while deploying for mobile? They aren't used in that case either... In code I can use #if UNITY_ANDROID to hide code containing MovieTexture, but how can I do this in the editor itself? I can avoid this by using WWWand load an .ogv video from StreamingAssets, but this would also mean that I need two files for the same video (one .mp4 and one .ogv).
Did you ever have any luck with this? I'm wondering the exact same question at the moment. I have different video-player solutions depending on the platform, but I can't find a way to gracefully handle the fact that iOS for example needs the videos to be in S$$anonymous$$$$anonymous$$gAssets but for standalone/PC builds I want it in the Resources folder. As you said, having a video in the Resources folder cases the iOS build to not compile, and I don't see an easy way to "exclude" it (even though I never reference it, the compiler doesn't care).
Answer by mdespault · Feb 23, 2016 at 02:29 PM
I re-posted a similar question and ended up finding a solution that worked for me anyway:
http://answers.unity3d.com/answers/1146086/view.html
I think my answer is awaiting moderation, but hopefully will be up soon. In a nutshell, I ended up storing my videos in AssetBundles to bypass the iOS MovieTexture compile errors
Your answer
Follow this Question
Related Questions
VideoPlayer streaming and buffering 0 Answers
Is it possible to access a file from the android Internal storage on to a Unity app during run time? 0 Answers
Integrating Intel-Media SDK with Unity 0 Answers
StreamingAssets Folder Max Size 2 Answers
How to integrate a video with alpha channel (rgb+alpha) in the new 5.6 videoplayer? 5 Answers