我正在實現AVAssetExportSession在線修剪視頻,但始終返回失敗。AVAssetExportSession exportAsynchronouslyWithCompletionHandler返回失敗
這是我實現:
NSString *url = @"http://www.ebookfrenzy.com/ios_book/movie/movie.mov";
NSURL *fileURL = [NSURL URLWithString:url];
AVAsset *asset = [AVAsset assetWithURL:fileURL];
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetHighestQuality];
NSURL *exportUrl = [NSURL fileURLWithPath:[documentsDirectory stringByAppendingPathComponent:@"export.m4a"]];
exportSession.outputURL = exportUrl;
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
CMTime time = CMTimeMake(1, 10);
exportSession.timeRange = CMTimeRangeMake(kCMTimeZero, time);
[exportSession exportAsynchronouslyWithCompletionHandler:^(void) {
switch (exportSession.status)
{
case AVAssetExportSessionStatusCompleted:
/*expor is completed*/
NSLog(@"Completed!!");
break;
case AVAssetExportSessionStatusFailed:
NSLog(@"failed!!");
/*failed*/
break;
default:
break;
}
}];
任何的你知道爲什麼出現這種情況還是什麼,我做錯了什麼?
我實現了你的解決方案和AVKeyValueStatus裏面的loadValuesAsynchronouslyForKeys塊,但我總是得到AVKeyValueStatusUnknown。你知道爲什麼嗎? – user2924482