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

feat(ios): add more video config options #24

Merged
merged 5 commits into from
Oct 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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