Search Unity

Question DownloadHandlerAudioClip audioClip's loadState is Unloaded

Discussion in 'Audio & Video' started by dujimache, Apr 12, 2021.

  1. dujimache

    dujimache

    Joined:
    Dec 17, 2011
    Posts:
    89
    unity version:2020.3.1f1
    os:windows 10

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Networking;

    public class Test : MonoBehaviour
    {
    // Start is called before the first frame update
    void Start()
    {
    var url = "file:///c://biu.mp3";
    DownloadHandlerAudioClip dlh = new DownloadHandlerAudioClip(url, AudioType.UNKNOWN);

    UnityWebRequest request = new UnityWebRequest(url, "GET", dlh, null);
    request.SendWebRequest();

    dlh.compressed = true;
    var audio = dlh.audioClip;
    Debug.Log(audio.loadState);
    }
    }

    the audio's state is Unloaded. the error is:

    Error: Cannot create FMOD::Sound instance for clip "" (FMOD error: An invalid parameter was passed to this function. )
    UnityEngine.StackTraceUtility:ExtractStackTrace ()

    can some body help me??? i am not familier with audio.

    the audio mp3 file is below.

    i just changed the file format to .txt. when run, please change to .mp3. Thank you!!
     

    Attached Files:

    • biu.txt
      File size:
      42.2 KB
      Views:
      280