Search Unity

Getting WindowsMediaError when trying to read videoclip downloaded with assetbundle

Discussion in 'Asset Bundles' started by Feydwin, Aug 12, 2019.

  1. Feydwin

    Feydwin

    Joined:
    Jan 11, 2013
    Posts:
    159
    Getting the following error :

    Code (CSharp):
    1. WindowsVideoMedia error 0x8007007b while reading archive:/CAB-8760a846a319d4e713c613d31c75bc19/CAB-8760a846a319d4e713c613d31c75bc19.resource
    2.  
    3. Context: MFCreateFile
    4. Error details: The filename, directory name, or volume label syntax is incorrect.
    5.  
    6. Track types:
    When i try to use a videoclip downloaded in an asset bundle.

    I am using the following code For downloading the asset bundle :

    Code (CSharp):
    1.  
    2. void Update()
    3.     {
    4.         if (hasPlayed == false && Input.GetKeyUp(KeyCode.Space))
    5.         {
    6.             hasPlayed = true ;
    7.             StartCoroutine ("IE_Download");
    8.         }
    9.     }
    10.  
    11.     IEnumerator IE_Download ()
    12.     {
    13.        
    14.         using (UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(url,1,3122757692))
    15.         {
    16.             request.SendWebRequest();
    17.  
    18.             while (!request.isDone)
    19.             {
    20.                 Debug.Log(request.downloadProgress);
    21.                 yield return null ;
    22.             }
    23.  
    24.             if (request.isNetworkError || request.isHttpError)
    25.             {
    26.                 Debug.Log("Error");
    27.             }
    28.             else
    29.             {
    30.                 Debug.Log("Downloaded");
    31.                 AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request);
    32.                 VideoClip clip = bundle.LoadAsset<VideoClip>("ta_02");
    33.                 player.clip = clip;
    34.                 StartCoroutine("IE_Play");
    35.             }
    36.         }
    37.     }
    38.  
    39.     IEnumerator IE_Play ()
    40.     {
    41.         player.Prepare();
    42.         yield return new WaitForSeconds(1.0f);
    43.         while (player.isPrepared == false)
    44.         {
    45.             yield return null ;
    46.         }
    47.         player.Play();
    48.     }
    49.  

    PS : Updated the post to reflect an easier code to read
     
    Last edited: Aug 13, 2019
  2. siz20971_Co

    siz20971_Co

    Joined:
    Jun 18, 2018
    Posts:
    6
    Hi.
    I have same issue and i'm not found solution yet.
    Have you try make downloaded assetbundle bytes to real file and load that file with AssetBundle.LoadFromFile?

    I'm using Unity 2019.1.10f and running well with AssetBundle.LoadFromFile.
    But if use AssetBundle.LoadFromMemory with same assetBundle, occue same error.

    I think, this issue occured when assetbundle load from memory.

    Sorry for nothing solution.
     
  3. Feydwin

    Feydwin

    Joined:
    Jan 11, 2013
    Posts:
    159
    I did not try that, not so sure how to go about trying it. What i currently have is :
    Code (CSharp):
    1. void Update()
    2.     {
    3.         if (hasPlayed == false && Input.GetKeyUp(KeyCode.Space))
    4.         {
    5.             hasPlayed = true ;
    6.             StartCoroutine ("IE_Download");
    7.         }
    8.     }
    9.  
    10.     IEnumerator IE_Download ()
    11.     {
    12.      
    13.         using (UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(url,1,3122757692))
    14.         {
    15.             request.SendWebRequest();
    16.  
    17.             while (!request.isDone)
    18.             {
    19.                 Debug.Log(request.downloadProgress);
    20.                 yield return null ;
    21.             }
    22.  
    23.             if (request.isNetworkError || request.isHttpError)
    24.             {
    25.                 Debug.Log("Error");
    26.             }
    27.             else
    28.             {
    29.                 Debug.Log("Downloaded");
    30.                 AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request);
    31.                 VideoClip clip = bundle.LoadAsset<VideoClip>("ta_02");
    32.                 player.clip = clip;
    33.                 StartCoroutine("IE_Play");
    34.             }
    35.         }
    36.     }
    37.  
    38.     IEnumerator IE_Play ()
    39.     {
    40.         player.Prepare();
    41.         yield return new WaitForSeconds(1.0f);
    42.         while (player.isPrepared == false)
    43.         {
    44.             yield return null ;
    45.         }
    46.         player.Play();
    47.     }
    Seems pretty straight forward, and seems more and more like a unity bug for me
     
  4. siz20971_Co

    siz20971_Co

    Joined:
    Jun 18, 2018
    Posts:
    6
    Check my thread.
    https://forum.unity.com/threads/ass...eoclip-is-not-working-and-occur-error.726875/

    I think, Unity 2019 has bug with assetbundle that contains single video.

    Does your AssetBundle contain only one video clip?