Skip to content

Instantly share code, notes, and snippets.

@lostincode
Last active September 29, 2016 23:52
Show Gist options
  • Save lostincode/d303434212c784ce0f91cd8327b9a00b to your computer and use it in GitHub Desktop.
Save lostincode/d303434212c784ce0f91cd8327b9a00b to your computer and use it in GitHub Desktop.
//TODO: get the 'AVComposition asset' first ;)
let uuid = UUID().uuidString
let exportPath = NSTemporaryDirectory().appendingFormat("\(uuid).mov")
let exportUrl = URL(fileURLWithPath: exportPath)
let exporter = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetHighestQuality)
exporter?.shouldOptimizeForNetworkUse = true
exporter?.outputURL = exportUrl
exporter?.outputFileType = AVFileTypeQuickTimeMovie
exporter?.exportAsynchronously(completionHandler: {
if exporter?.status == .completed {
let url = exporter?.outputURL
DispatchQueue.main.async {
//ayy
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment