Skip navigation
Nimitt12345
Currently Being Moderated

Store Music files

May 25, 2011 11:07 PM

How to store music files using Adobe Air ??

lets say m developing desktop application. in which user ll upload music localy. i want to store that music to my application folder. is it possible ?? n how ??

 
Replies
  • Currently Being Moderated
    May 26, 2011 1:08 AM   in reply to Nimitt12345

    Hello,

    there is dedicated property in flash.filesystem.File to reflect OS-specific application data location, see:

    http://www.igorcosta.com/flex3/doc/flash/filesystem/File.html#applicat ionStorageDirectory

    It would create application specific data storage e.g. in locations like (here on OS X):

    /Users/{USER_NAME}{/Library/Preferences/{APP_NAME}/

    You would get data-storage feature for free with that path and api shortcut.

    But once you get accustomed to how use native paths, you could consider optimizing that data storage in case you're planning to store several large data assets, see:

    http://blogs.adobe.com/simplicity/2010/01/api_tip_dont_abuse_fileappli ca.html

     

    kind regards,

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    May 26, 2011 2:41 AM   in reply to Nimitt12345

    Hello,

    In AIR runtime you would use flash.filesystem.File class to nearly all work related to files. It wraps methods that allows you to find files, search for them, browser for them, etc. including copying/moving and deleting (files and directories):

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/filesystem/File.html

    This class has properties that are shortcuts to most commonly used paths and additions useful when working with paths in filesystem (like trivial OS-specific separator) and methods you need to learn if you wan't to store files and move them.

    The other useful and *core* object from AIR runtime you would use is FileStream I think:

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/filesystem/FileStream.html

    It lets you to write/read content from/to File object. So for example when you get data from some source as bytes - you would save them into local file using combination of flash.filesystem.File and flash.filesystem.FileStream.

     

    regards,

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 7:35 AM   in reply to Peter Blazejewicz

    Hello,

     

    How can I save the music, pdf, or any file to Sqlite Database?

     

    Thanks.

     
    |
    Mark as:
  • Currently Being Moderated
    May 8, 2012 1:39 AM   in reply to jack182

    Hi,

     

    you need BLOB type to be defined in table and then just write ByteArray representation of your object into this field in table using UPDATE/SET INSERT SQL methods.

    Please try this Adobe's sample to see how JPEG image data is persisted in local database:

    http://www.adobe.com/devnet/air/flex/articles/sqlite_db_api_in_air.htm l

    (when application starts for the first tiem and there is no .db file - CREATE table statement is used to create empty table that would be later popuplated. JPEG itself is created as result of Camera capture action and converting to JPEG image format - but how you aqauire your data is up to you).

    Some people would certianly oppose your plan to store binary content in BLOB fields that way - instead advocating of storing file paths and moving your content into "iTunes" like library data folder managed by database file.

     

     

    hth,

    kind regards,

    Peter Blazejewicz

     
    |
    Mark as:
  • Currently Being Moderated
    May 8, 2012 5:55 AM   in reply to Peter Blazejewicz

    Hi Peter,

     

    Thanks for the reply. I already thinking to store the link of the file to db but whenever i will update the data, i need to delete the file in the directory and replace it with new one and also for security purpose it can easily be seen.

     

    Im comtemplating to store pdf files on sqlite as blob. Any pros and cons in storing blob data in sqlite?

     

    Cheers.

    Thanks a lot.

    Eman

     
    |
    Mark as:
  • Currently Being Moderated
    May 9, 2012 8:46 AM   in reply to jack182

    Hi Eman,

     

    try this:

    http://www.sqlite.org/intern-v-extern-blob.html

    ("Internal Versus External BLOBs in SQLite")

    Gather your sample content and then run tests yourself to see if at this point of development performance is serious topic in your application. If you do not notice performance lags on average machine go with your current implementation.

     

    kind regards,

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    May 9, 2012 9:38 AM   in reply to Peter Blazejewicz

    Hi Peter,

     

    Thanks. Will give it a shot.

     

    Cheers.

    Eman

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points