以下のコードを使用して、トリミングのためにライブラリからオーディオを取得しています
ここで私の問題は、オーディオを取得できますが、オーディオを取得するのに時間がかかることです
AAVURLAsset *songAsset = [AVURLAsset URLAssetWithURL:appDelegate.librarySongURL オプション:nil];
NSLog (@"Core Audio %@ directly open library URL %@",
coreAudioCanOpenURL (appDelegate.librarySongURL) ? @"can" : @"cannot",
appDelegate.librarySongURL);
NSLog (@"compatible presets for songAsset: %@",
[AVAssetExportSession exportPresetsCompatibleWithAsset:songAsset]);
AVAssetExportSession *exporter = [[AVAssetExportSession alloc]
initWithAsset: songAsset
presetName: AVAssetExportPresetAppleM4A];
NSLog (@"created exporter. supportedFileTypes: %@", exporter.supportedFileTypes);
[self handlePlayPauseDefault:0];
exporter.outputFileType = @"com.apple.m4a-audio";
NSString *exportFile = [myDocumentsDirectory() stringByAppendingPathComponent: @"exported.m4a"];
myDeleteFile(exportFile);
appDelegate.libraryUrl = [NSURL fileURLWithPath:exportFile];
exporter.outputURL = appDelegate.libraryUrl;
[exporter exportAsynchronouslyWithCompletionHandler:^{
int exportStatus = exporter.status;
switch (exportStatus) {
case AVAssetExportSessionStatusFailed: {
NSError *exportError = exporter.error;
NSLog (@"AVAssetExportSessionStatusFailed: %@", exportError);
break;
}
case AVAssetExportSessionStatusCompleted: {
NSLog (@"AVAssetExportSessionStatusCompleted");
self.navigationController.navigationBar.userInteractionEnabled = YES;
break;
}
case AVAssetExportSessionStatusUnknown: { NSLog (@"AVAssetExportSessionStatusUnknown"); break;}
case AVAssetExportSessionStatusExporting: { NSLog (@"AVAssetExportSessionStatusExporting"); break;}
case AVAssetExportSessionStatusCancelled: { NSLog (@"AVAssetExportSessionStatusCancelled"); break;}
case AVAssetExportSessionStatusWaiting: { NSLog (@"AVAssetExportSessionStatusWaiting"); break;}
default: { NSLog (@"didn't get export status"); break;}
}
}];
誰でも私を助けることができますか?