Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Addressable videos not working on Android

Discussion in 'Addressables' started by rmuk, Nov 26, 2018.

  1. rmuk

    rmuk

    Joined:
    Feb 18, 2015
    Posts:
    46
    I have a mobile project (both iOS/Android) and I recently tried moving all of the video assets we have over to addressables. On iOS builds they play just fine, however on Android they do not load. I am seeing the following error:
    AndroidVideoMedia::OpenExtractor could not translate archive:/CAB-5ac6a43aade2e32bbe0b94c06f8a0126/CAB-5ac6a43aade2e32bbe0b94c06f8a0126.resource to local file. Make sure file exists, is on disk (not in memory) and not compressed.


    Right below that is this:
    AndroidVideoMedia: Error opening extractor: -10004


    Here is the code used to load the video:
    public void loadVideo(string imagePath)
    {
    Addressables.LoadAsset<VideoClip>(imagePath).Completed += onLoadDone;
    }

    private void onLoadDone(UnityEngine.ResourceManagement.IAsyncOperation<VideoClip> obj)
    {
    GetComponent<VideoPlayer>().clip = obj.Result;
    }



    Some other bits of info:
    - The file plays perfectly if i just include it in the project and don't use it with addressables
    - The file is HEVC
     
  2. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Thanks for the info, I've filed a bug in our system about this.
     
  3. rmuk

    rmuk

    Joined:
    Feb 18, 2015
    Posts:
    46
    Thanks! Is this on a public bug tracker so that I can just watch that page for updates, or is it internal only?
     
  4. MrCool92

    MrCool92

    Joined:
    Jul 13, 2015
    Posts:
    25
    This is because videos are inside compressed bundle and should not be... Just put them in streaming assets and stream them via url or uncompressed bundle.

    Tip: enable send ready events of video player, subscribe to on frame ready and enable video canvas to avoid "last video frame" bug.

    edit: correcting myself.. this behavior is not a bug.
     
    Last edited: Apr 26, 2019
  5. Piflik

    Piflik

    Joined:
    Sep 11, 2011
    Posts:
    278
    I get the same error with videos I try to load from the disk (not part of the apk, nor in an asset bundle or in streaming assets, just a video file in /storage/emulated/0/BUNDLE_IDENTIFIER).
     
  6. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    360
    MrCool92 likes this.
  7. vzlomvl

    vzlomvl

    Joined:
    Jun 25, 2016
    Posts:
    39
    Hi @unity_bill
    I have similar error on Android with loading of the Video from Addressable with Uncompressed remote group. Adressable version 1.6.2.
    Unity version 2018.4.17.
    Android version 9.0
    Do you have plan to fix this issue in upcoming releases? And if not, are there any workarounds for loading video from addressable remote group on Android?
    Thanks.
     
  8. vzlomvl

    vzlomvl

    Joined:
    Jun 25, 2016
    Posts:
    39
    JFYI error message is the same:
    AndroidVideoMedia::OpenExtractor could not translate archive:/CAB-0e93fe237ec0f897d04b37ebb9d6d416/CAB-0e93fe237ec0f897d04b37ebb9d6d416.resource to local file. Make sure file exists, is on disk (not in memory) and not compressed.
    AndroidVideoMedia: Error opening extractor: -10004
     
    DavidZobrist likes this.
  9. florinel2102

    florinel2102

    Joined:
    May 21, 2019
    Posts:
    56
    For anyone who has the same issue caused by addresable system , try to build addressable (window->asset managment -> addresable -> build -> new build -> default build script) before exporting.
     
  10. Dev_HNK

    Dev_HNK

    Joined:
    Feb 5, 2020
    Posts:
    1
    The following settings worked for me:

    - Turn off Cache Compression in script: Caching.compressionEnabled = false;
    - Set Assetpack Compression to None
     
    Last edited: Sep 3, 2020
    vasik_frag and DavidZobrist like this.
  11. Zampilo

    Zampilo

    Joined:
    May 6, 2018
    Posts:
    12
    i try everything and none work :/
     
  12. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    40
    Hi there! Running into the same issues all are having with running video from addressables on Android. One question, what's the impact will setting compressionEnabled to false have? Does that mean ALL addressable assets are now unable be be compressed in the local cache (thus bloating size on disk more)? Am I some how selectively able to set compression enabled for the majority of assets and have it non enabled for videos. I tried putting all my videos in an Addressable group with compression and caching turned off and this does not seem to work.

    I also read that this might be fixed in Unity 2020 but we're trying to stick to 2019 LTS until 2020 LTS is ready. So looking for workaround basically that doesn't completely turn off compression for all addressables.

    Any help would be greatly appreciated!
     
  13. Patrick_PS

    Patrick_PS

    Joined:
    Sep 9, 2019
    Posts:
    133
    I have put the video in its own addressable group and only set that group to not use compression (group inspector => Compressions => Uncompressed).
     
    nnton3 likes this.
  14. nnton3

    nnton3

    Joined:
    Sep 8, 2017
    Posts:
    14
    Can u show your inspector and what code did u use?
     
  15. Patrick_PS

    Patrick_PS

    Joined:
    Sep 9, 2019
    Posts:
    133
    The only relevant thing I changed in the inspector is compression.

    By code you mean how I load it? I have an AssetReference in a script in the scene and during runtime I call
    Code (CSharp):
    1. AsyncOperationHandle<VideoClip> handle = Addressables.LoadAssetAsync<VideoClip>(assetReference.RuntimeKey);
    In the callback method I use handle.Result to get the clip.
    Don't forget to release the handle after playing the video.
     
  16. nnton3

    nnton3

    Joined:
    Sep 8, 2017
    Posts:
    14
    Thanks for ur reply)
     
  17. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    40
    Weird I've tried the same thing. Where I have an addressable group that's dedicated to storing videos and it's set to uncompressed. I wonder if it's related to me instantiating a single prefab which then loops through addressable dependencies (one being the video). I am not directly loading the video as you are. I'll try to do a direct load and report back. Thanks!
     
  18. LilMako17

    LilMako17

    Joined:
    Apr 10, 2019
    Posts:
    41
    I literally just ran into the same thing. Yes, all the asset bundles will be stored as uncompressed in the cache just so you can get the video files to work. I don't think this is an acceptable solution. The only alternatives to make video files work that I can see is either embedding the video files in the client, or not having caching for video files.
     
  19. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    40
    FWIW not really a solve. But we transitioned to using Video Player's URL video playback instead of Addressables for this and it works pretty well. Again, not really a solve but a nice alternative to explore if you're able to.
     
  20. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    360
    As of Unity 2020.2 this has been fixed, but only for Android 9 and up
     
    DavidZobrist likes this.
  21. LilMako17

    LilMako17

    Joined:
    Apr 10, 2019
    Posts:
    41
    I did try URL loading/streaming working in our project, but it seems significantly slower than asset bundle loading for short clips, and there doesn't seem to be a way to measure download status/ progress, or react to errors. For my specific use case, I think I'll go with embedding the video clip assets in the client's streaming assets since they are going to be small, and fairly static assets. But the URL thing is a viable work around for other scenarios.
     
  22. cwennchen

    cwennchen

    Joined:
    Nov 22, 2019
    Posts:
    7
    1、Check that the addressables group for the sound is set to Uncompressed
    2、Check if there is a custom build.gradle in the project and add '.bundle' to the noCompress in the gradle.

    aaptOptions {
    noCompress '.unity3d', '.ress', '.resource', '.obb', '.meta', '.wem', '.bnk', '.txt', '.xml','.bundle' //ADD_NoCompress_TAG
    }
     
unityunity