cancel
Showing results for 
Search instead for 
Did you mean: 

UnityWebRequestMultimedia audio not playing on Oculus Go

youjeanz
Honored Guest
Hi, so we have a text-to-speech method that downloads audio from a url. This audio works perfectly fine on the "play mode" of Unity, however, when trying  to run the build on the Oculus Go, the audio from the text-to-speech doesn't seem to be playing at all. All the audios except text-to-speech seem to be doing perfectly fine on the Oculus though. Moreover, it doesn't seem to be a network error as proven through the if/else statement in the code. We're not sure if it's an issue based on formatting or just the UnityWebRequest audio handling.
Here's the part of the code that does text-to-speech (C#)
------------------------------------------------------------------------
    IEnumerator DownloadTheAudio(string speech) {
       //Debug.Log("general speak method");
       string url = "https://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q="+speech+"&tl=en-US";
       using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG)) {
           yield return www.Send(); ;

           if (www.isNetworkError)
           {
               Debug.Log(www.error);
               yield break;
           }
           else
           {
               //_audio is declared inside the class as "public AudioSource _audio"
               AudioClip myClip = DownloadHandlerAudioClip.GetContent(www);
               _audio.clip = myClip;
               _audio.Play();
           }
       }

   }
-------------------------------------------------------------------
And here's a sample method that would run that script vvv
-------------------------------------------------------------------
    public void Greet() {
        string person = "Bob";
        string speech = "Nice to meet you " + person;
        StartCoroutine(DownloadTheAudio(speech));
    }
--------------------------------------------------------------------
0 REPLIES 0