Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!



In iOS4, you're able to access to the raw audio data of files stored in the user's iPod Library, but the method isn't straightforward: You must first make a local copy of the file. And that isn't straightforward, either. To get a local copy you must use AVAssetExportSession with the passthrough preset, write the file to a QuickTime .mov file and then extract the audio data out of the .mov file to whatever container is appropriate. (Any other method involves an extremely lengthy transcode step.)

The TSLibraryImport class hides this complexity behind a simple interface.


Add TSLibraryImport.h and TSLibraryImport.m to your project. Make sure you also add AVFoundation.framework to your project.

To import a file:

MPMediaItem* item; //obtained using MediaPlayer.framework APIs
NSURL* assetURL = [item valueForProperty:MPMediaItemPropertyAssetURL];
NSURL* destinationURL ...; //file URL for the location you'd like to import the asset to.
TSLibraryImport* import = [[TSLibraryImport alloc] init];
[import importAsset:assetURL toURL:outURL completionBlock:^(TSLibraryImport* import) {
    //check the status and error properties of

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.