Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class func compressVideo(_ inputURL: URL, outputURL: URL, handler:@escaping (_ session: AVAssetExportSession)-> Void){
- let urlAsset = AVURLAsset(url: inputURL, options: nil)
- let exportSession = AVAssetExportSession(asset: urlAsset, presetName: AVAssetExportPresetMediumQuality)
- exportSession!.outputURL = outputURL
- exportSession!.outputFileType = AVFileType.mp4
- exportSession!.shouldOptimizeForNetworkUse = true
- exportSession!.exportAsynchronously { () -> Void in
- handler(exportSession!)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement