Play a song from the superpower ipod library
since Apple announced that every application must support 64-bit starting February 1st, I can no longer use Dirac3LE. So I found Superpowered, which seems to do the same. The only problem I am currently seeing is that I cannot get it to play songs from the iPod library.
I tried to import the song via AVAssetExportSession but can't get it to work. This is the code I have tried so far:
NSURL *url = [playingSong valueForProperty:MPMediaItemPropertyAssetURL];
AVURLAsset *songAsset = [AVURLAsset URLAssetWithURL:url options:nil];
AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset: songAsset presetName: AVAssetExportPresetPassthrough];
exporter.outputFileType = @"com.apple.coreaudio-format";
NSString *fname = [[NSString stringWithFormat:@"tmp"] stringByAppendingString:@".mp3"];
NSString *tempPath = NSTemporaryDirectory();
NSString *exportFile = [tempPath stringByAppendingPathComponent: fname];
exporter.outputURL = [NSURL fileURLWithPath:exportFile];
[exporter exportAsynchronouslyWithCompletionHandler:^{
self.player = [[SuperpoweredAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:exportFile]];
[self.player play];
}];
Opening the file through:
player->open([[url path] fileSystemRepresentation]);
Even if it works, I am concerned that it will be fast enough for a music player. Import a song as soon as another ends.
Are there any other options?
Thank!
+3
source to share