I\'ve got an app that exports an AVMutableComposition
into a .mov
file, and I\'d like for the user to see the status of the export with a progress bar
Same issue i have faced in iOS 8.0, i resolved it using dispatch quee
- (void)convertVideoToLowQuailtyWithInputURL:(NSURL*)inputURL outputURL:(NSURL*)outputURL handler:(void (^)(AVAssetExportSession*))handler{
[[NSFileManager defaultManager] removeItemAtURL:outputURL error:nil];
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:inputURL options:nil];
exportSession2 = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetLowQuality];
exportSession2.outputURL = outputURL;
exportSession2.outputFileType = AVFileTypeQuickTimeMovie;
[exportSession2 exportAsynchronouslyWithCompletionHandler:^(void)
{
handler(exportSession2);
}];
dispatch_async(dispatch_get_main_queue(), ^(void){
self.exportProgressBarTimer = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(updateExportDisplay) userInfo:nil repeats:YES];
});
}