- Home /
Question by
MOJAJA · Aug 16, 2019 at 07:41 AM ·
androidaudiodownloadwebrequest
Android can't download the audio
Hi all,
I write the code ,that I want to use TTS ,and it's can work on PC not Android.
Why it can't work on Android ?
IEnumerator DownloadTheAudio()
{
string url = "https://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=cat&tl=En-gb";
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG))
{
yield return www.SendWebRequest();
if(www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
AudioClip source = DownloadHandlerAudioClip.GetContent(www);
_audio.clip = source;
_audio.Play();
}
}
Comment
Your answer
Follow this Question
Related Questions
How to check if DownloadHelperAudioClip still has internet connection for streaming during playback? 0 Answers
How to stream audio before completely downloaded? 0 Answers
See Request of WWW or UnityWebRequest, 403 error only from android in a specific url (GET) 2 Answers
DownloadHandlerAudioClip compressed and streamAudio properties 0 Answers
How to check if someone has download another app of yours? 2 Answers