Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Large videos on Oculus Go; Apk larger than obb; Crash on start

Discussion in 'VR' started by Wattosan, Sep 17, 2019.

  1. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    456
    Hello,

    I have 4 videos with sizes around 600 MB each. I need to play them on the Oculus Go device (Android). The application does not need to be uploaded to the Oculus store. It will be sideloaded onto the device. The application needs to work offline.

    The problem is that if I simply add them to the Unity project and build the project, the .apk is over 3GB large. This in itself is not a problem I think because I can install the .apk just find via the adb. However when I try to launch the app, it crashes before it even gets to the Unity logo splash screen.
    My guess is that it tries to load the videos into RAM as soon as the app starts. And since the size of the videos is almost 3GB, the application runs out of memory and crashes.

    I tried to enable the "Split application binary" to create the .obb files, however the created .obb file is only around 3MB, while the .apk remains at around 3GB. Does anyone know why the videos do not get added to the .obb? I only have a single scene in the application. Is that the problem?

    Then I tried to add the video files to the StreamingAssets folder, hoping that the way it works is that the videos do not get loaded into memory immediately. However, the app still crashes. I did test with one video (to get the application working at all on Oculus Go) and try to play the video using the uri in the videoplayer, which referenced the video file in StreamingAssets. And it worked, meaning the videos are indeed in the StreamingAssets folder. But for some reason, the application still crashes as soon as the .apk file size exceeds 2GB.

    Are asset bundles going to help me in any way here? Or is there something else I can do? Why does the application crash, even though the videos are added to the StreamingAssets folder?
    I would like to avoid adding videos manually to the device. The videos should come along with the installation.

    I realize this question has been asked before but i have failed to find a working answer.

    Thank you!
     
  2. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    456
    I now tested with adding only a single video with the "Split application binary" set to true. And it did create the .obb (weird that it did not do it before). Then I added another video and it worked (the size of .obb is around 1.5GB). Then I added the third and got the error that the .obb cannot be larger than 2GB for the Google Store. So the build failed. This did not happen before. What happened was that the videos were just added to the .apk. Perhaps restarting the project/laptop cleaned the Temp folder and that fixed something.

    However, now I'm stuck at the next issue. The .obb cannot be larger than 2GB. How can I create multiple .obb files and pass them along with the installation? Or how can I increase the size of the .obb to 4GB? Should I use asset bundles instead (got the hint from here: link)?

    I realize the 2GB limit is for the Google Store. But there is also an Oculus Store, which accepts 4GB files. Why is this not an option in Unity?
     
  3. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    456
    It seems that what actually prevented the crash was setting the Scripting Backend from Mono to IL2CPP and setting the Target Architecture to ARM64.
     
    vuplex and Sir-Gatlin like this.
  4. uz986

    uz986

    Joined:
    Oct 29, 2017
    Posts:
    12
    Hello there, I tried what you said there but it is still not working, I have also 3.5 gb size of apk and it crashes on Oculus Quest
     
  5. Sir-Gatlin

    Sir-Gatlin

    Joined:
    Jan 18, 2013
    Posts:
    28
    Thank you! This fixed my issue perfectly and was exactly what I was dealing with. I had to install Androind NDK but that was a quick install, here is Unities page talking about Androind NDK (all the way at the bottom)
    https://docs.unity3d.com/560/Documentation/Manual/android-sdksetup.html

    changed the settings as you said in my player settings, installed NDK selected the right ndk file, built and no crash. the build took longer this way, but worth it for actually being able to work.
    I really appreciate you came back and updated your post @Wattosan, really saved me this time.
     
  6. mitshah

    mitshah

    Joined:
    Jul 3, 2019
    Posts:
    5
    Thanks, This fixed my issue and saved a lot of time.
     
  7. Joebobaggins

    Joebobaggins

    Joined:
    Apr 26, 2016
    Posts:
    3
    @Wattosan! you legend! i was getting knocked around by this all day, arm64 fixed it
     
  8. stenfeio

    stenfeio

    Joined:
    Jan 18, 2015
    Posts:
    22
    Awesome. The backend changes and arm64 made this work. Any idea what's causing this? Is it an issue of addressable memory being larger on 64 bit architectures?