Raptor
Raptor

Reputation: 54260

UIImagePickerController shows only Videos folder but not others like Selfies and Slo-mo

When using UIImagePickerController, I can filter videos only to display iOS 12 (also applies to iOS 10+) using the codes below:

picker.allowsEditing = false
picker.mediaTypes = ["public.movie"]
picker.sourceType = .photoLibrary
if #available(iOS 11.0, *) {
   picker.videoExportPreset = AVAssetExportPresetPassthrough
}
present(picker, animated: true, completion: nil)

However, a lot of iOS default folders are displayed, such as Moments, Camera Roll, Recently Added, Videos, Selfies, Slo-mo and other albums I created.

How can I just display the Videos folder?

Upvotes: 4

Views: 802

Answers (1)

Sergey Kuryanov
Sergey Kuryanov

Reputation: 6114

You can try to specify UIImagePickerControllerSourceTypeSavedPhotosAlbum as source type. It will show all videos only.

picker.sourceType = .savedPhotosAlbum

Also instead of using string for media types better use constant:

import MobileCoreServices
...
picker.mediaTypes = [kUTTypeMovie as String]

Upvotes: 1

Related Questions