- Home /
Question by
MsMete · Aug 07, 2014 at 10:09 AM ·
iosaudioclipaudioclip www load
IOS Load AudioClip from local
Hi,
I use this code for iOS path:
public static string GetiPhoneDocumentsPath ()
{
string path = Application.dataPath.Substring (0, Application.dataPath.Length - 5);
path = path.Substring(0, path.LastIndexOf('/'));
return path + "/Documents";
}
Documents folder include many .wav files. I want to play this audioClips.
I try this code:
string filepath = Path.Combine(GetiPhoneDocumentsPath(),SongName);
AudioClip my = (AudioClip)Resources.Load(filepath, typeof(AudioClip));
audio.clip = my;
audio.Play();
but didn't work :(
How can I do???
Comment
Use WWW class to get files from other place than the resource folder.
WWW www = new WWW( "file://" + filepath + "/SongName.wav");
audio.clip = www.GetAudioClip(false,false, AudioType.UN$$anonymous$$NOWN);
Change the audio type and extansion so it fits your file properties. I didn't tested on iOS though.
GL
cheers
Xcode error line:
UIApplication$$anonymous$$ain(argc, argv, nil, [NSString stringWithUTF8String:AppControllerClassName]);
ERROR : libc++abi.dylib: ter$$anonymous$$ate called throwing an exception
Didn't work :(
Your answer
![](https://koobas.hobune.stream/wayback/20220613160040im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Anyone been able to load an audio file from local filesystem on iOS and playback a clip? 2 Answers
WWW.GetAudioClip Freeze 1 Answer
Game Lagging in iOS 0 Answers
Playing a sound effect on Touch HELP 0 Answers