From c68a0a61a654177feddcd80eaf6adeb54db034d9 Mon Sep 17 00:00:00 2001 From: Alfie Hanssen Date: Thu, 31 Mar 2016 11:25:12 -0400 Subject: [PATCH] moving VIM-3844 changes into this PR since a lot has changed and there will be merge conflicts --- VimeoUpload/Upload/Operations/Async/ExportOperation.swift | 5 +++-- .../Async/iOS8/PHAssetExportSessionOperation.swift | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/VimeoUpload/Upload/Operations/Async/ExportOperation.swift b/VimeoUpload/Upload/Operations/Async/ExportOperation.swift index 269c998a..12bde5a1 100644 --- a/VimeoUpload/Upload/Operations/Async/ExportOperation.swift +++ b/VimeoUpload/Upload/Operations/Async/ExportOperation.swift @@ -52,7 +52,7 @@ class ExportOperation: ConcurrentOperation convenience init(asset: AVAsset) { - let exportSession = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetHighestQuality)! + let exportSession = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetPassthrough)! self.init(exportSession: exportSession) } @@ -115,7 +115,8 @@ class ExportOperation: ConcurrentOperation } // AVAssetExportSession does not do an internal check to see if there's ample disk space available to perform the export [AH] 12/06/2015 - + // However this check will not work with presetName "passthrough" since that preset reports estimatedOutputFileLength of zero always. + let availableDiskSpace = try? NSFileManager.defaultManager().availableDiskSpace() // Double optional if let diskSpace = availableDiskSpace, let space = diskSpace where space.longLongValue < self.exportSession.estimatedOutputFileLength { diff --git a/VimeoUpload/Upload/Operations/Async/iOS8/PHAssetExportSessionOperation.swift b/VimeoUpload/Upload/Operations/Async/iOS8/PHAssetExportSessionOperation.swift index 0d2c881b..ff354052 100644 --- a/VimeoUpload/Upload/Operations/Async/iOS8/PHAssetExportSessionOperation.swift +++ b/VimeoUpload/Upload/Operations/Async/iOS8/PHAssetExportSessionOperation.swift @@ -46,7 +46,7 @@ class PHAssetExportSessionOperation: ConcurrentOperation self.cleanup() } - init(phAsset: PHAsset, exportPreset: String = AVAssetExportPresetHighestQuality) + init(phAsset: PHAsset, exportPreset: String = AVAssetExportPresetPassthrough) { self.phAsset = phAsset self.exportPreset = exportPreset