Sign In Register

How can we help you today?

Start a new topic

Error downloading file audio - Unity 3D

H  

 public void DownloadAFileAudio()
    {
        new GetDownloadableRequest()
            .SetShortCode(shortCodeSong)
            .Send((response) =>
            {
                GSData scriptData = response.ScriptData;
                shortCodeSong = response.ShortCode;
                var size = response.Size;
                Debug.Log("Dimensione:" + size);
                Debug.Log("Short Code:" + shortCodeSong);
                urlItemSong = response.Url;
                Debug.Log("Short Code:" + urlItemSong);
            });
        Debug.Log(urlItemSong);
        //yield return urlItemSong;
        StartDownloadAudio(urlItemSong);
    }

    public void StartDownloadAudio(string urlPassed)
    {
        StartCoroutine(DownloadAudio(urlPassed));
    }


    public IEnumerator DownloadAudio(string urlPassed)
    {
        WWW audioLoader = new WWW(urlPassed);
        while (!audioLoader.isDone && audioLoader.progress < 0.1f)
        {
            Debug.Log("Loading progress " + audioLoader.progress);
            yield return new WaitForSeconds(0.5f);
        }

        Debug.Log("Starting playback size " + audioLoader.bytesDownloaded);
        downloadedSong.clip = audioLoader.GetAudioClip(false, true, AudioType.OGGVORBIS);
        downloadedSong.Play();
        downloadedSong.volume = 1;
    }

  

image


1 Comment

hello to all, I write to you after trying for several hours to solve this problem, I do not know why but when I download the audio file gives me what you see in the picture. I am also attaching the script

Login to post a comment