Playing large video files in Gear VR in Unity project

I’m creating a Gear VR android app that plays a large 30 minute video. I have read that I should not use the StreamingAssets folder, but I don’t see any information about what I should be using instead. If I put the video in Assets/videos it is not included in the android build. Should I be using the resources folder or is there another way to include the video? (My project is also on iOS, but I’m currently not having any problems on that platform.) I have read that the PersistentDataPath folder can be used, but I don’t know how to get my video into that folder when from unity. I don’t want to copy the video there and have two 600mb files when only one is used.

The PersistentDataPath is a local folder on the android phone. You should put your video into this folder and then using unity to load the video using VideoPlayer.url.

Can you be more specific? I’m not sure how to put the video into the PersistantDataPath.

Have a look at the wiki: Unity - Scripting API: Application.persistentDataPath

This specific path depends on the target platform. On windows it is located in %userprofile%\AppData\Local\Packages<productname>\

On Android it is located at Android/file/com.your.appid/files (either SD card or the actual phone memory).

EDIT: you can simply drag and drop the video in the folder on your phone by connecting it to your computer.

Hope this helps.

Thanks for your response. This is an app I’m putting in the Oculus store. I need a way for the video to be placed there when the APK is installed.

Usually I use the persistent data path for dynamically loaded content, settings and such (it remains even when the app is deinstalled).
Since you need a large file right from the beginning and do not want to download it (e.g. dynamically download it to the persistent data path or use Asset Bundles), I don’t see why you shouldn’t use the streaming assets folder.

The restrictions on APKs for the oculus store are not as strict as for the playstore (~100MB), so it should not be an actual problem if your APK is several hundred MBs.

I believe the problem is that when storing the video in the StreamingAssets folder it is packed into a JAR file and has to be loaded into RAM to be played. What happened is that when I submitted my build to the Gear VR store it is failing to play on the S6 running Lollipop. I have read that for large video files can have problems in Gear VR.

I can assure that streaming large video files form the persistent data path works (I tried videos up to 500mb).
What you could therefore try to do is loading the video file from either the StreamingAssets folder or a Resource folder and save it on the persistent data path on the device. This way you could stream it from there with the native Movie Player.

streaming assets path will put the video file in the Jar which is not accessible by most API’s.
However the Video Player in 5.6+ is able to stream from the streaming assets path.

Another way is to include the video file in your assets and just link the video clip to the Unity Video Player component. It should be included in the apk then, the only thing you’d have to do is call the play method

depending on your goal either streaming assets or just normal assets could be used

I wouldn’t recommend Resources that would explode your memory usage.

Another way is by streaming it from a server using the Video Player API, set the URL and just prepare and play it.