Im attempting to select assets using PHPickerViewController
as a replacement for my UIImagePickerController
, however when setting the filter
and config
options Im not seeing a way to set a limit on the length of video that is returned. i.e. the way one may have done using a UIImagePickerController
through videoMaximumDuration
.
Has anyone found any sort of workout?
private func presentPicker(filter: PHPickerFilter?)-> PHPickerViewController {
var configuration = PHPickerConfiguration(photoLibrary: .shared())
// Set the filter type according to the user’s selection.
configuration.filter = filter
// Set the mode to avoid transcoding, if possible, if your app supports arbitrary image/video encodings.
configuration.preferredAssetRepresentationMode = .current
// Set the selection behavior to respect the user’s selection order.
configuration.selection = .ordered
// Set the selection limit to enable singular selection.
configuration.selectionLimit = 1
// Set the preselected asset identifiers with the identifiers that the app tracks.
configuration.preselectedAssetIdentifiers = []
let picker = PHPickerViewController(configuration: configuration)
//picker.delegate = self
//present(picker, animated: true)
return picker
}