Search Unity

Bug Having extreme trouble with gradle & Oculus NativeVideoPlayer in 2022.2.0b

Discussion in 'VR' started by LucasHehir, Dec 7, 2022.

  1. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    It looks as though the 'NativeVideoPlayer' component in the Oculus Unity SDK uses version 2.9.5 of the Android exoplayer video player package in order to achieve high performance video playback. Our team has used this component before with great results, however it doesn't appear to work anymore for various reasons. It should be noted that exoplayer 2.9.5 is vastly out of date; the latest version is 2.18.2 at time of writing.

    If you try to build out just the Stereo180Video scene from the SDK, you get no video playback and the following error from adb:

    Failed to get class NativeVideoPlayer


    You're meant to enable the NativeVideoPlayer class support from the Oculus menu inside Unity, specifically Oculus > Samples > Video > Enable Native Android Video Player

    Now the real trouble starts. After this point, seemingly nothing will get a build past the gradle phase now. There are endless errors regarding the formatting, availability, etc of gradle, exoplayer and the NativeVideoPlayer.java plugin.

    I did a bit of digging and found that Google's maven repository that was hosting 2.9.5 was shutdown last year (jCenter?) and even if you start trying to edit gradle manually to add a valid repository (like jitpack.io) gradle still chokes on the apparent file format and says:

    zip end header not found


    It's supposed to be possible to include exoplayer 2.9.5 locally and reference that in gradle too, but I couldn't find a version of 2.9.5 in .jar format anywhere online which seems to be the expected type.

    Is there any fix to this situation? My guess is that the unique combination of Unity 2022.2.0b's newer version of gradle, the sunsetting of jcenter and the out of dated-ness of exoplayers implementation is all causing an incompatability traffic jam and I'm at the extent of my knowledge to intercept myself.
     
    Last edited: Dec 7, 2022
  2. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    I just tried building the exact same project with 2022.1.23f1 and it works straight away.

    My understanding is that 2022.2 uses a newer version of gradle - maybe rolling back the version of gradle it uses would work?
     
  3. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    We pinged Meta about this - they're looking into upgrading their component to work with 2022.2b. I'll update when I hear back.
     
    Lucas-Hehir likes this.
  4. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    Excellent news, thank you!
     
  5. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    Meta says they found a fix to the issue, and should be able to ship it by the end of January 2023, with v49 SDK.
     
    LucasHehir likes this.
  6. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    Champion! This is great news for our team, thanks for passing it on.
     
  7. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    Hey team, sorry for the resurrection but the v49 SDK dropped and I'm a bit lost.

    It looks as though the native Android video player has been removed entirely, rather than fixed. I installed using the Meta XR Integration Installer v49 and installed all 3 packages from the scoped registry without issue. I just can't find any reference to the native video player anymore.

    That's okay if so, I can work around it, just wanted to make sure I'm not missing anything obvious.

    Cheers!
     
  8. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    Ah I see it's part of the .unitypackage SDK still. I am still having gradle issues when building however.

    Issue #1:

    android:exported needs to be explicitly specified for element <activity#com.unity3d.player.UnityPlayerActivity>

    Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

    FAILURE: Build failed with an exception.​

    Solution #1:

    Insert android:exported="true" alongside the other arguments of line 4 of AndroidManifest.xml

    Issue #2:

    Dependency 'com.google.android.exoplayer:exoplayer:2.18.2' requires 'compileSdkVersion' to be set to 33 or higher. Compilation target for module ':launcher' is 'android-31'​

    Solution #2:

    Open mainTemplate.gradle and change the version of exoplayer being targeted to 2.18.1. For whatever reason, 2.18.2 seems to require an Android API upgrade from 29 to 33, while 2.18.1 can happily stay at 29. My current understanding is that Oculus Quest 2 runs on API 29 but I could be wrong.

    After doing that, ExoPlayer can build and run as expected.
     
    abegue and FaberVi like this.