Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
feat(ios): add more video config options (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdlerJS committed Oct 10, 2021
1 parent cdf0006 commit 2833f38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ Open the ImagePicker
- asBase64 (boolean) **default: false**
- asJpeg (boolean) **default: false**
- videoCompression (string) ([Available Options](https://github.com/Yummypets/YPImagePicker/blob/23158e138bd649b40762bf2e4aa4beb0d463a121/Source/Configuration/YPImagePickerConfiguration.swift#L226-L240)) **default: AVAssetExportPresetHighestQuality**
- recordingTimeLimit (number) **default: 60.0** **IOS only**
- libraryTimeLimit (number) **default: 60.0** **IOS only**
- minimumTimeLimit (number) **default: 3.0** **IOS only**

```js
window.AdvancedImagePicker.present({
Expand Down
6 changes: 6 additions & 0 deletions src/ios/AdvancedImagePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import YPImagePicker
let asBase64 = options?.value(forKey: "asBase64") as? Bool ?? false;
let videoCompression = options?.value(forKey: "videoCompression") as? String ?? "AVAssetExportPresetHighestQuality";
let asJpeg = options?.value(forKey: "asJpeg") as? Bool ?? false;
let recordingTimeLimit = options?.value(forKey: "recordingTimeLimit") as? NSFloat ?? 60.0;
let libraryTimeLimit = options?.value(forKey: "libraryTimeLimit") as? NSFloat ?? 60.0;
let minimumTimeLimit = options?.value(forKey: "minimumTimeLimit") as? NSFloat ?? 3.0;

if(max < 0 || min < 0) {
self.returnError(error: ErrorCodes.WrongJsonObject, message: "Min and Max can not be less then zero.");
Expand All @@ -53,6 +56,9 @@ import YPImagePicker
config.library.skipSelectionsGallery = true;
config.library.preSelectItemOnMultipleSelection = false;
config.video.compression = videoCompression;
config.video.recordingTimeLimit = recordingTimeLimit;
config.video.libraryTimeLimit = libraryTimeLimit;
config.video.minimumTimeLimit = minimumTimeLimit;

if(startOnScreen == "IMAGE") {
config.startOnScreen = .photo;
Expand Down

0 comments on commit 2833f38

Please sign in to comment.