Skip to main content
Jul 13, 2011 12:42 AM UTC
Answered

IOS: (not) playing sound from local file system - Error #2032

Dear all,

I am working on an app where I want to (among others) play sound files from the local file system.

I have added a few mp3 files into my .ipa file.

With a small file browser in my app I can select any one of them which returns me a File object.

I then use this File object to do a URLRequest to load the sound:

var req:URLRequest = new URLRequest(file.nativePath);

sound = new Sound();

sound.addEventListener(IOErrorEvent.IO_ERROR, soundLoadError);
sound.addEventListener(Event.COMPLETE, soundLoaded);
sound.load(req);

It works in flash, but fails on the iPAD. Everytime I try to load, I get a IOErrorEvent with error code Error #2032

When I replace new URLRequest(file.nativePath) with URLRequest("http://.../testfile.mp3"), everything works fine!

Any help appreciated.

Is this a matter of Security settings? Can I change those?

Something to do with Sandboxing (whatever that is)?

or something to do with cross-domain access?

I have been looking around for days now and any help would be appreciated!

I am using Flash CS5.5 & AIR 2.7

Thanks, Marcus.

This topic is closed to new replies. Start a new post to keep the conversation going.
blazejewiczCorrect answer
Participating Frequently
Jul 13, 2011 7:34 AM UTC

Hi Marcus,

can you try (or maybe have you tried):

var path:String = file.url;

var req:URLRequest = new URLRequest(path);

?

regards,

Peter

11 replies

blazejewiczCorrect answer
Participating Frequently
Jul 13, 2011 7:34 AM UTC

Hi Marcus,

can you try (or maybe have you tried):

var path:String = file.url;

var req:URLRequest = new URLRequest(path);

?

regards,

Peter

Translate
Jul 13, 2011 7:46 AM UTC

yes, that is working.

thank you so much!

var req:URLRequest = new URLRequest(file.url);

Translate
Participating Frequently
Jul 13, 2011 8:03 AM UTC

Hi Marcus,

OK, that's buried somewhere in flash.filesystem.File docs: some api and components in Flash/Air runtime details do require URI/URL *not* native path

(I cannot find specific paragraph right now but I"m sure I've read that in Adobe's docs),

regards,

Peter

Translate
Colin Holgate
Inspiring
Jul 13, 2011 12:47 AM UTC

Did you add the sound file in your iOS settings, under the General tab?

Translate
Jul 13, 2011 12:54 AM UTC

Yes, the files were added under the general tab.

In my application, I have a custom browser showing me all my files in my application path. It looks something like this:

[ META-INF ]

[ ...CodeSIgnature ]

[ cs.lproj ]

[ de.proj ]

(etc)

testsound1.mp3 (<- the included mp3 files)

testsound2.mp3

testsound3.mp3

CodeResources

AppIcon.png

(etc)

Translate
Jul 13, 2011 5:01 AM UTC

maybe it's not allowed to read from the path:

/var/mobile/Applications/6206ED19-1875-B70B-B41AFF5BDA3D/Main.app/music/TranceOne.mp3

?

Translate