This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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