显示的错误是这样。昨晚工作,我睡了,现在 得到这个错误。谁可能现在会发生什么?实际上,今天我的顶峰防御发生在这件事上?????
(Unsupported file or audio format. )
UnityEngine.WWW:GetAudioClip(Boolean, Boolean, AudioType)
<DownloadTheAudio>c__Iterator0:MoveNext() (at Assets/Script/TextToSpeech.cs:42)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
这是我的代码的样子:
public AudioSource _audio;
public Text inputText;
// Use this for initialization
void Start()
{
_audio = gameObject.GetComponent<AudioSource>();
}
// Update is called once per frame
void Update()
{
}
IEnumerator DownloadTheAudio()
{
Regex rgx = new Regex("\\s+");
string result = rgx.Replace(inputText.text, "+");
string url = "http://api.voicerss.org/?key=<apikey>=en-us&src=" + result;
WWW www = new WWW(url);
yield return www;
// There seems to be a problem on this part:
_audio.clip = www.GetAudioClip(false, true, AudioType.MPEG);
_audio.Play();
}
public void OnMouseDown()
{
StartCoroutine(DownloadTheAudio());
}