I’m trying to load and play an wav file that exists in my Application.dataPath
but when the game gets to this line _GoAudioSource.PlayOneShot(audioLoader.audioClip);
It justs throws a empty exception and no sound is played.
I’ve already checked if the path is correct and it is. I’ve also tried uploading this wav file to an FTP and loading it via HTTP
instead of File:///
but nothing changes.
This is my full code:
private IEnumerator WriteResponseAudio(ResponseModel res)
{
File.WriteAllBytes(Path.Combine(Application.dataPath, FILENAME_RESPONSE), Convert.FromBase64String(res.intent.audio.content));
string path = "file:///" + Application.dataPath + "/" + FILENAME_RESPONSE;
WWW audioLoader = new WWW(path);
yield return audioLoader;
try
{
_GoAudioSource.PlayOneShot(audioLoader.audioClip);
} catch (Exception ex)
{
Debug.LogError("Erro: " + ex.Message);
}
}
private IEnumerator WriteResponseAudio(ResponseModel res)
{
File.WriteAllBytes(Path.Combine(Application.dataPath, FILENAME_RESPONSE), Convert.FromBase64String(res.intent.audio.content));
string path = "http://www.raphaelrosa.com/response.wav";
WWW audioLoader = new WWW(path);
yield return audioLoader;
try
{
_GoAudioSource.PlayOneShot(audioLoader.audioClip);
} catch (Exception ex)
{
Debug.LogError("Erro: " + ex.Message);
}
}
This is the console:
Does anyone have an idea of what’s causing this?