Objective-C class + sample code for importing files from user's iPod Library in iOS4.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Classes
iPodLibraryAccess.xcodeproj Changed SDK to 'Latest' Feb 14, 2011
quicktime_parse
.hgignore
LICENSE Add MIT License for library. Feb 13, 2012
MainWindow.xib Initial import from filesystem — got iPod library export working! Jun 19, 2010
README.md
Tests-Info.plist * Added unit test target/code. Jul 10, 2010
Tests.m Cleaned up code Jul 10, 2010
iPodLibraryAccess-Info.plist
iPodLibraryAccessViewController.xib
iPodLibraryAccess_Prefix.pch
main.m

README.md

TSLibraryImport

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.

Use

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
	//TSLibraryImport
}