统一-文本到语音在Android上不起作用

时间:2018-12-05 07:31:01

标签: c# unity3d text-to-speech

我使用google translation web进行android文本到语音转换。它在PC上工作正常,但是当我在android设备上安装它时,它无法正常工作。这是我的代码:

public class TextToSpeech : MonoBehaviour{


public AudioSource _audio;

public InputField inputText;






// Use this for initialization
void Start()
{
    _audio = gameObject.GetComponent<AudioSource>();

}

// Update is called once per frame
void Update()
{

}

IEnumerator DownloadTheAudio()
{

    string url = "https://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=" +inputText.text + "&tl=En-gb";
    WWW www = new WWW(url);
    yield return www;


    _audio.clip = www.GetAudioClip(false, true, AudioType.MPEG);
    _audio.Play();


}

public void OnMouseDown()
{
    StartCoroutine(DownloadTheAudio());



}

}

知道我的代码有什么问题吗?

0 个答案:

没有答案