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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Video in assetbundle not loading in IL2CPP, working in Mono

Discussion in 'Android' started by ben06feb, Nov 7, 2020.

  1. ben06feb

    ben06feb

    Joined:
    Oct 2, 2012
    Posts:
    42
    Hi, I have bundled my video and trying to load that video clip in unity video player, it is working fine in 32 bit version build (Mono), not at all working with IL2CPP (64 bit) - same working in Editor. Please do help me to resolve the issue. This is for Android platform.

    Regards,
    Ben
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,669
    Check the logcat for errors.
     
  3. ben06feb

    ben06feb

    Joined:
    Oct 2, 2012
    Posts:
    42
     

    Attached Files:

  4. ben06feb

    ben06feb

    Joined:
    Oct 2, 2012
    Posts:
    42
    This is the function used to stream bundle and assigned to video player, from getting the clip.
    Code (CSharp):
    1. public IEnumerator GetAssetBundle(string filePath)
    2.     {
    3.         //Download everytime
    4.         //UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(filePath);
    5.         //Re-load cache
    6.         Debug.Log("filePath - "+ filePath);
    7.         UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(filePath, 1, 0);
    8.         yield return www.SendWebRequest();
    9.  
    10.         if (www.isNetworkError || www.isHttpError)
    11.         {
    12.             string errorMsg = "Error download - " + www.error;
    13.             Debug.Log(errorMsg);
    14.             ShowMessage(errorMsg);
    15.         }
    16.         else
    17.         {
    18.             ShowMessage("Downloading bundles");
    19.             AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
    20.             loadedBundle = bundle;
    21.  
    22.             VideoClip video = loadedBundle.LoadAsset<VideoClip>(videoAssetName);
    23.             videoPlayer.clip = video;
    24.             videoPlayer.Play();
    25.  
    26.              ShowMessage("Download completed");
    27.             StopAllCoroutines();
    28.         }
    29.     }
     
  5. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,669
    Can you switch to Development build, since Release, has limited output to logcat?

    Also can you show, how are you calling GetAssetBundle ?
     
  6. ben06feb

    ben06feb

    Joined:
    Oct 2, 2012
    Posts:
    42
    Hi Tom, There is no error displays in log, even build is in dev mode. I have attached the source and log details here along with the script used to stream assets. Bundles are created in uncompressed format, it is available with source. Source also have details of URL where bundles uploaded and name of the video I am streaming in. Please do check, it is a show stopper for me from releasing the app.

    Source - https://drive.google.com/file/d/1FX-E3yQb6KdhTgkjYPSjDfl617BCRmEu/view?usp=sharing

    Regards,
    Ben
     

    Attached Files:

  7. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,669
    In the logcat it still says 'Release', can you attach logcat from Development
     
  8. ben06feb

    ben06feb

    Joined:
    Oct 2, 2012
    Posts:
    42
    Please check the files attached.
     

    Attached Files:

  9. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,669
  10. ben06feb

    ben06feb

    Joined:
    Oct 2, 2012
    Posts:
    42
  11. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,669
    Not sure if it will work, but did you try requesting a video file instead of a bundle and access that instead?
     
  12. sasob8

    sasob8

    Joined:
    Jul 11, 2017
    Posts:
    25
    Any update on this issue? I have similar problem. I am using Unity 2020.3.8.

    I need to play video from Streaming assets (because it will be downloaded from server). Video has alpha channel, so i tried using VP8, but i found out that Android doesn't support it, so Unity has to transcode it. That means i can't play directly from Streaming assets, so i made AssetBundle. This assetbundle can be in Streaming assets, and everything works perfectly (alpha channel also) - using Mono (ARM v7).
    But when i use IL2CPP i can't load video.

    Am i stuck with Mono?