Skip to content

Commit

Permalink
fix(video): 馃悰 apply quality to both recordings and image picking (#1776)
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan-dutoit committed Sep 21, 2021
1 parent b1e2161 commit de1ba82
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ PODS:
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsinspector (0.63.2)
- react-native-image-picker (4.0.3):
- react-native-image-picker (4.0.6):
- React-Core
- React-RCTActionSheet (0.63.2):
- React-Core/RCTActionSheetHeaders (= 0.63.2)
Expand Down Expand Up @@ -357,7 +357,7 @@ SPEC CHECKSUMS:
React-jsi: 54245e1d5f4b690dec614a73a3795964eeef13a8
React-jsiexecutor: 8ca588cc921e70590820ce72b8789b02c67cce38
React-jsinspector: b14e62ebe7a66e9231e9581279909f2fc3db6606
react-native-image-picker: 474cf2c33c2b6671da53d293a16c97995f0aec15
react-native-image-picker: a6e56460d34905c849ada551db30897dc7f3d535
React-RCTActionSheet: 910163b6b09685a35c4ebbc52b66d1bfbbe39fc5
React-RCTAnimation: 9a883bbe1e9d2e158d4fb53765ed64c8dc2200c6
React-RCTBlob: 39cf0ece1927996c4466510e25d2105f67010e13
Expand Down
34 changes: 17 additions & 17 deletions ios/ImagePickerUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ @implementation ImagePickerUtils

+ (void) setupPickerFromOptions:(UIImagePickerController *)picker options:(NSDictionary *)options target:(RNImagePickerTarget)target
{
if ([[options objectForKey:@"mediaType"] isEqualToString:@"video"]) {

if ([[options objectForKey:@"videoQuality"] isEqualToString:@"high"]) {
picker.videoQuality = UIImagePickerControllerQualityTypeHigh;
}
else if ([[options objectForKey:@"videoQuality"] isEqualToString:@"low"]) {
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
}
else {
picker.videoQuality = UIImagePickerControllerQualityTypeMedium;
}
}

if (target == camera) {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;

if (options[@"durationLimit"] > 0) {
picker.videoMaximumDuration = [options[@"durationLimit"] doubleValue];
}

if ([options[@"cameraType"] isEqualToString:@"front"]) {
picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
} else {
picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
}

if ([[options objectForKey:@"mediaType"] isEqualToString:@"video"]) {

if ([[options objectForKey:@"videoQuality"] isEqualToString:@"high"]) {
picker.videoQuality = UIImagePickerControllerQualityTypeHigh;
}
else if ([[options objectForKey:@"videoQuality"] isEqualToString:@"low"]) {
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
}
else {
picker.videoQuality = UIImagePickerControllerQualityTypeMedium;
}

if (options[@"durationLimit"] > 0) {
picker.videoMaximumDuration = [options[@"durationLimit"] doubleValue];
}
}
} else {
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
Expand Down

0 comments on commit de1ba82

Please sign in to comment.