Skip to content Skip to sidebar Skip to footer

As3 Android Saving Remote Sounds On Sdcard - Accessing Later?

This code is way cool! Try it. It creates a folder in your user called .007 and saves an mp3 called yahoo.mp3. It will also do it on an android device if permissions are set corre

Solution 1:

file:// <-------The Answer!

Got it! The file path needed to access the "sdcard" on a Android phone must begin with: file://

If you want to load a sound from your phone it would look like this. Here is the one important line needed. I will post full code below.

mySound.load(newURLRequest("file://mnt/sdcard/AnyFolder/YourSound.mp3"));

Since I was using a loop above getting all the files in a particular folder this is the code that worked for me in the example above.

mySound.load(newURLRequest("file://"+files[0].nativePath));

FULL CODE TO LOAD AND PLAY SOUND ON DROID

varmySound:Sound = newSound();
varmyChannel:SoundChannel = newSoundChannel();
varlastPosition:Number = 0;
mySound.load(newURLRequest("file://mnt/sdcard/AnyFolder/YourSound.mp3"));
myChannel = mySound.play();

I worked very hard on to find this answer. I hope this helps many. Please remember to +1 if this code has helped you. :)

I love StackOverflow! :)

Post a Comment for "As3 Android Saving Remote Sounds On Sdcard - Accessing Later?"