public static void OnAudioClipDownloaded(DownloadAudioClipEventArgs e) { Debug.Log("Audio downloaded event triggered."); var handler = AudioClipDownloaded; if (handler != null) { handler(null, e); } }
public IEnumerator RequestAudio(DownloadMediaEventArgs media) { Debug.Log(string.Format("Requesting Audio {0}", media.FileName)); if (media.FileName.Length <= 0 || media.FileName == null) { yield break; } var www = UnityWebRequestMultimedia.GetAudioClip( ServerURL.DownloadMediaUrl(media.FileName), AudioType.OGGVORBIS); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); yield break; } var audioClip = ((DownloadHandlerAudioClip)www.downloadHandler) .audioClip; var audioArgs = new DownloadAudioClipEventArgs { DownloadGuid = media.DownloadGuid, FileName = media.FileName, MediaType = media.MediaType, Clip = audioClip }; Debug.Log("Audio Download Successful."); EventManager.OnAudioClipDownloaded(audioArgs); }