1 Reply Latest reply on Mar 19, 2012 12:03 PM by alexandru.ro

    FBB - Get MP3 data from Android?

    foolish3737 Level 1

      I'm trying to build an MP3 Player for the Android OS. I was wondering if it was possible to collect music data from the phone (ie. a list of mp3's on the phone, path locations, etc). If this isn't possible, what are my options? Would I need to scan the phone and locate all mp3 files and then store them?

        • 1. Re: FBB - Get MP3 data from Android?
          alexandru.ro

          I'm currently working on the same kind of project , an mp3 player for android purely for the cause of learning more Air development and for the simple fact of all the mp3 players in android market (including the payed ones) none have captured my vision (mostly because of UI arhitecture). To answer your question i will post you my bits of code that i used to get those file references. Currently my aim is to have the user select the folder where he normaly stores mp3's and the air app would then scan that folder and create a playlist (or multiple lists). So far i am using a test folder wich i created on my phones sd card (myairmusic). And the app si predefined to target that folder to search for mp3 and store their "data" in wich case is their location on sdcard, then it pushes it into an array.

           

           

          public var folder:File;

          public var files:Array;

           

           

          public function scanFolder()

                              {                            

                                         folder = File.desktopDirectory

                                        

                                         //This is to check the os that the ap is currently running on (i have a "music" folder on desktop for testing purposes in windows);

                                         if (Capabilities.os.search("Windows")>=0)

                                         {

                                                   folder = folder.resolvePath("music")

                                         }

                                         else

                                         {

                                                   folder = folder.resolvePath("/mnt/sdcard/myairmusic")

                                         }

                                         files = folder.getDirectoryListing();

                                      

           

                              }