diff --git a/ios/Compression.m b/ios/Compression.m index 7c9158a..007f7e5 100644 --- a/ios/Compression.m +++ b/ios/Compression.m @@ -11,16 +11,20 @@ @implementation Compression - (instancetype)init { - self.exportPresets = @{ - @"640x480": AVAssetExportPreset640x480, - @"960x540": AVAssetExportPreset960x540, - @"1280x720": AVAssetExportPreset1280x720, - @"1920x1080": AVAssetExportPreset1920x1080, - @"3840x2160": AVAssetExportPreset3840x2160, - @"LowQuality": AVAssetExportPresetLowQuality, - @"MediumQuality": AVAssetExportPresetMediumQuality, - @"HighestQuality": AVAssetExportPresetHighestQuality, - }; + NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithDictionary:@{ + @"640x480": AVAssetExportPreset640x480, + @"960x540": AVAssetExportPreset960x540, + @"1280x720": AVAssetExportPreset1280x720, + @"1920x1080": AVAssetExportPreset1920x1080, + @"LowQuality": AVAssetExportPresetLowQuality, + @"MediumQuality": AVAssetExportPresetMediumQuality, + @"HighestQuality": AVAssetExportPresetHighestQuality, + }]; + NSOperatingSystemVersion systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; + if (systemVersion.majorVersion >= 9) { + [dic addEntriesFromDictionary:@{@"3840x2160": AVAssetExportPreset3840x2160}]; + } + self.exportPresets = dic; return self; } @@ -74,9 +78,9 @@ } - (void)compressVideo:(NSURL*)inputURL - outputURL:(NSURL*)outputURL - withOptions:(NSDictionary*)options - handler:(void (^)(AVAssetExportSession*))handler { + outputURL:(NSURL*)outputURL + withOptions:(NSDictionary*)options + handler:(void (^)(AVAssetExportSession*))handler { NSString *presetKey = [options valueForKey:@"compressVideoPreset"]; if (presetKey == nil) {