@@ -17,6 +17,8 @@ public enum CompressionResult {
1717
1818// Compression Interruption Wrapper
1919public class Compression {
20+ public init ( ) { }
21+
2022 var cancel = false
2123}
2224
@@ -33,35 +35,37 @@ public struct CompressionError: LocalizedError {
3335
3436public struct LightCompressor {
3537
38+ public init ( ) { }
39+
3640 private let MIN_BITRATE = Float ( 2000000 )
3741 private let MIN_HEIGHT = 640.0
3842 private let MIN_WIDTH = 360.0
3943
4044 /**
41- * This function compresses a given [source] video file and writes the compressed video file at
42- * [destination]
43- *
44- * @param [source] the path of the provided video file to be compressed
45- * @param [destination] the path where the output compressed video file should be saved
46- * @param [quality] to allow choosing a video quality that can be [.low],
47- * [.medium], and [.high]. This defaults to [.medium]
48- * @param [isMinBitRateEnabled] to determine if the checking for a minimum bitrate threshold
49- * before compression is enabled or not. This default to `true`
50- * @param [keepOriginalResolution] to keep the original video height and width when compressing.
51- * This defaults to `false`
52- * @param [progressHandler] a compression progress listener that listens to compression progress status
53- * @param [completion] to return completion status that can be [onStart], [onSuccess], [onFailure],
54- * and if the compression was [onCancelled]
55- */
45+ * This function compresses a given [source] video file and writes the compressed video file at
46+ * [destination]
47+ *
48+ * @param [source] the path of the provided video file to be compressed
49+ * @param [destination] the path where the output compressed video file should be saved
50+ * @param [quality] to allow choosing a video quality that can be [.low],
51+ * [.medium], and [.high]. This defaults to [.medium]
52+ * @param [isMinBitRateEnabled] to determine if the checking for a minimum bitrate threshold
53+ * before compression is enabled or not. This default to `true`
54+ * @param [keepOriginalResolution] to keep the original video height and width when compressing.
55+ * This defaults to `false`
56+ * @param [progressHandler] a compression progress listener that listens to compression progress status
57+ * @param [completion] to return completion status that can be [onStart], [onSuccess], [onFailure],
58+ * and if the compression was [onCancelled]
59+ */
5660
5761 func compressVideo( source: URL ,
58- destination: URL ,
59- quality: VideoQuality ,
60- isMinBitRateEnabled: Bool = true ,
61- keepOriginalResolution: Bool = false ,
62- progressQueue: DispatchQueue ,
63- progressHandler: ( ( Progress ) -> ( ) ) ? ,
64- completion: @escaping ( CompressionResult ) -> ( ) ) -> Compression {
62+ destination: URL ,
63+ quality: VideoQuality ,
64+ isMinBitRateEnabled: Bool = true ,
65+ keepOriginalResolution: Bool = false ,
66+ progressQueue: DispatchQueue ,
67+ progressHandler: ( ( Progress ) -> ( ) ) ? ,
68+ completion: @escaping ( CompressionResult ) -> ( ) ) -> Compression {
6569
6670 var frameCount = 0
6771 let compressionOperation = Compression ( )
0 commit comments