【发布时间】:2014-10-29 22:13:04
【问题描述】:
自从 Apple 宣布从 2 月 1 日开始每个应用程序都必须支持 64 位,我不能再使用 Dirac3LE。所以我发现 Superpowered 似乎也是如此。我目前看到的唯一问题是,我无法让它播放 iPod 库中的歌曲。
我尝试通过 AVAssetExportSession 导入歌曲,但无法正常工作。这是我到目前为止尝试过的代码:
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];
}];
通过以下方式打开文件:
player->open([[url path] fileSystemRepresentation]);
即使这样可行,我有点担心这对于音乐播放器来说是否足够快。导入一首歌曲,一首歌曲完成。
还有其他选择吗?
谢谢!
【问题讨论】:
-
我也在使用超级强大的 sdk,但我无法进行时间拉伸。请你帮助我好吗?提前致谢
-
由于我没有在适当的时间让导入工作,我不使用超级动力。如果只是时间拉伸avaudioplayer就足够了。否则你可以考虑 MTAudioProcessingTap 和相应的 AudioUnits。
-
@Dimitri:你找到解决办法了吗?
标签: ios objective-c audio