Hola,
Is it still true that Unity's built-in audio player can't play audio from the /Documents folder in iOS?
So I'd still have to use AVAudioPlayer?
ty
Hola,
Is it still true that Unity's built-in audio player can't play audio from the /Documents folder in iOS?
So I'd still have to use AVAudioPlayer?
ty
Julian,
I am loading ogg-vorbis formated files from the documents folder on my iPad and iPhone. I did this so my Audio engineer would be able to update sounds in my game while in development so I would not have to do a new build each time he wanted to change the audio clips.
Contrary to what the Unity web site (documentation) states, ogg-vorbis files seem to work just fine on iDevices when loaded via WWW. It is wav that cannot be loaded via WWW.
Here's a code snippet for you
var www : WWW = new WWW("file://" + docPath + localPath);
yield www;
if(www.error == null){
print("Loaded local bundle - instantiating :: " + www.assetBundle.mainAsset.name);
Instantiate(www.assetBundle.mainAsset, Vector3(0, 0, 1.5), Quaternion.identity);
print("INSTANTIATED FROM LOCAL");
}
As far I know it should work.
I've got it working with an external call to AVAudioPlayer on the iPad but all my attempts failed when using www.audioclip. The iPhone docs never even mention playing external audio on iPhone.
– Julian-Glennhow did you load ogg files from documents folder?
this is what i tried.
.........
www = new WWW("file:///var/mobile/Applications/6832F66D-DC62-40A1-A026-2436F6479CE1/Documents/song.ogg");
if (www == null)
return null;
return www.oggVorbis;
...........
Wouldn't that require an pre-made .unity3d file at localpath? I'm talking about .wav files created in the app and saved in /Documents/ Like I say I've tried www.audioclip.
– Julian-Glenn