NSArray *pres = [AVAssetExportSession exportPresetsCompatibleWithAsset:asset];
if([pres containsObject:AVAssetExportPreset640x480]) {
AVAssetExportSession *session = [[AVAssetExportSession alloc]initWithAsset:asset presetName:AVAssetExportPreset640x480];
FileManagerUtilities *fUtil = [[FileManagerUtilities alloc]init];
session.outputURL = [NSURL fileURLWithPath:[fUtil searchPathDirectory:NSDocumentDirectory byAppendingDirectoryPath:nil andFileName:@"tempVideo.mov"]];
session.outputFileType = AVFileTypeQuickTimeMovie;
session.fileLengthLimit = 10.0;
[session exportAsynchronouslyWithCompletionHandler:^{
switch ([session status]) {
case AVAssetExportSessionStatusFailed:
NSLog(@"Export failed: %@", [[session error] localizedDescription]);
break;
case AVAssetExportSessionStatusCancelled:
NSLog(@"Export canceled");
break;
default:
break;
}
}];
}
Я пытаюсь установить session.fileLengthLimit
на 10mb, но не знаю, какую ошибку я делаю. Невозможно ограничить размер до 10mb, как установить fileLengthLimit
на 10mb.Нужна помощь в отношении AVAssetExportSession
Пытались ли вы установить значение в байтах (то есть 10 * 1024 * 1024)? – quentinadam