SHARE
TWEET

Untitled

a guest Jul 12th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class func compressVideo(_ inputURL: URL, outputURL: URL, handler:@escaping (_ session: AVAssetExportSession)-> Void){
  2.         let urlAsset = AVURLAsset(url: inputURL, options: nil)
  3.  
  4.         let exportSession = AVAssetExportSession(asset: urlAsset, presetName: AVAssetExportPresetMediumQuality)
  5.  
  6.         exportSession!.outputURL = outputURL
  7.  
  8.         exportSession!.outputFileType = AVFileType.mp4
  9.  
  10.         exportSession!.shouldOptimizeForNetworkUse = true
  11.  
  12.         exportSession!.exportAsynchronously { () -> Void in
  13.             handler(exportSession!)
  14.         }
  15.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top