public GetAudioClip ( bool threeD, bool stream ) : |
||
threeD | bool | Use this to specify whether the clip should be a 2D or 3D clip /// the .audioClip property defaults to 3D. |
stream | bool | Sets whether the clip should be completely downloaded before it's ready to play (false) or the stream can be played even if only part of the clip is downloaded (true). /// The latter will disable seeking on the clip (with .time and/or .timeSamples). |
return |
public AudioClip GetAudioClip(bool threeD, bool stream)
{
return this.GetAudioClip(threeD, stream, AudioType.UNKNOWN);
}
WWW::GetAudioClip ( bool threeD ) : |
|
WWW::GetAudioClip ( bool threeD, bool stream, AudioType audioType ) : |
private IEnumerator DownloadAudio() { _url = input_url.text; //#if !UNITY_EDITOR // _url = _url.Replace("http://www.spilldemo.com", Application.dataPath + "/.."); //#endif Debug.Log("_url: " + _url); yield return new WaitForSeconds(0.5f); WWW www = new WWW(_url); yield return www; string extension = _url.Substring(_url.Length - 4); Debug.Log("extension: " + extension); if (extension.Equals(".ogg")) _source.clip = www.GetAudioClip(false, false, AudioType.OGGVORBIS); else if (extension.Equals(".mp3")) _source.clip = www.GetAudioClip(false, false, AudioType.MPEG); else if (extension.Equals(".wav")) _source.clip = www.GetAudioClip(false, false, AudioType.WAV); else _source.clip = www.GetAudioClip(false, false, AudioType.UNKNOWN); yield return new WaitForSeconds(0.5f); _source.Play(); }