Skip to content

Instantly share code, notes, and snippets.

@lsmolic

lsmolic/gist:7669633

Created Nov 27, 2013
Embed
What would you like to do?
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:[self.project.composition copy] presetName:AVAssetExportPresetPassthrough];
NSURL* outputURL = [self createTempAssetFileURL:@"export"];
exportSession.outputURL = outputURL;
// exportSession.outputFileType=AVFileTypeQuickTimeMovie;
exportSession.outputFileType=AVFileTypeMPEG4;
[exportSession exportAsynchronouslyWithCompletionHandler:^{
switch (exportSession.status) {
case AVAssetExportSessionStatusFailed:{
NSError *exportError = exportSession.error;
NSLog (@"AVAssetExportSessionStatusFailed: %@", exportError);
[self performSelectorOnMainThread:@selector (failedToSaveAsset:)
withObject:nil
waitUntilDone:NO];
break;
}
case AVAssetExportSessionStatusCompleted: {
NSLog (@"SUCCESS");
[self performSelectorOnMainThread:@selector (uploadAsset:)
withObject:outputURL
waitUntilDone:NO];
break;
}
default:
NSLog(@"some other status : %d",exportSession.status);
NSLog(@"%@",exportSession);
};
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment