- Home /
Question by
ReadyPlayGames · Oct 03, 2018 at 08:22 PM ·
audiowwwdownloadwebrequest
DownloadHandlerAudioClip compressed and streamAudio properties
How does one use the DownloadHandlerAudioClip properties "compressed" and "streamAudio"?
The "streamAudio" property is especially confusing, doesn't the www.SendWebRequest make sure it downloads the whole file first?
This is what I was able to come up with:
IEnumerator DownloadAudioClip(){
using(UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileAddress, AudioType.OGGVORBIS)){
yield return www.SendWebRequest();
if(www.isNetworkError){
Debug.Log(www.error);
}else{
DownloadHandlerAudioClip download = (DownloadHandlerAudioClip)www.downloadHandler;
// Compressed:
//download.compressed = true;
// Or streaming:
download.streamAudio = true;
AudioClip myClip = download.audioClip;
if(myClip != null){
Debug.Log("AudioClip downloaded successfully");
// Do stuff with it...
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How to stream audio before completely downloaded? 0 Answers
How to check if DownloadHelperAudioClip still has internet connection for streaming during playback? 0 Answers
Android can't download the audio 1 Answer
Download progress is -1 forever. 2 Answers
See Request of WWW or UnityWebRequest, 403 error only from android in a specific url (GET) 2 Answers