I am trying to load a .wav using the WWW class. This works fine on Windows (PC) and Android. But on my iPhone 4 the app freezes when calling the method below (it stays in the while loop).
Does someone have an idea about what is going wrong?
private Track LoadTrack(string pathname)
{
WWW audioToLoadPath = new WWW("file://" + pathname);
while (!audioToLoadPath.isDone)
{
//Wait untill it's done
}
Track loadedAudio = Instantiate(TrackInstantiator) as Track;
loadedAudio.GetAudioSource().clip = audioToLoadPath.GetAudioClip(true, false);
return loadedAudio;
}
The pathname i am passing is retrieved by something like this (simplified exampe):
DirectoryInfo info = new DirectoryInfo(Application.persistentDataPath);
string pathname = persistentInfo.GetDirectories ()[0].FullName;
Edit:
The path put in the WWW class is:
file:///var/mobile/Applications/APP_GUID/Documents/file3.wav
XCode is not giving me any hints/debug information about this.
Also audioToLoadPath.error is empty.
Other things i have tried:
- Remove 'File://'
- Tried it with 'File://' and 'File:///'
- Tried 'File://localhost/var/...'
↧