Skip to content

Instantly share code, notes, and snippets.

@lsmolic
Created November 27, 2013 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmolic/7669633 to your computer and use it in GitHub Desktop.
Save lsmolic/7669633 to your computer and use it in GitHub Desktop.
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