- Home /
Sound not playing on Galaxy S4 device
I'm making a small language vocab card game in which I'm using a HTTP Get/Post to a Text to Speech API in order to get the proper pronunciation of a vocab word. Everything works fine in the inspector, but when I tried it on my Galaxy S4 device, it did not work.
Some details on the sound clip: it's in MP3 format and 48kHz 16bit stereo. Here's some code:
IEnumerator waitForRequest(WWW www) {
yield return www;
if (www.error == null) {
AudioClip audio = www.GetAudioClip(false, false, AudioType.MPEG);
StartCoroutine(playClip(audio));
} else {
Debug.Log("there's an error.");
Debug.Log(www.error);
}
}
IEnumerator playClip(AudioClip audio) {
source.clip = audio;
source.Play();
isVoice = true;
yield return new WaitForSeconds(audio.length);
isVoice = false;
source.Stop();
}
AudioSource and AudioListener are attached to the main camera. I'm using it from code attached to another GameObject. The sound files I'm getting back are really short.
Comment