I have a UIImagePickerController
and I want the users to be able to pick videos and photos for their photos. There's no problem allowing that, but when I select a video (I'm testing this on a iPhone XR simulator) it shows the compressing video screen and it never process the video. And it's not a long video, it's just a sample demo video (5 seconds long). The video plays normally in the simulator, but for some reason it's stuck on the compression.
It's not just this video, its ANY video and I'm not sure if im doing something wrong or not.
@objc func handleSelectPhoto() {
let pickerController = UIImagePickerController()
pickerController.delegate = self
pickerController.mediaTypes = ["public.image", "public.movie"]
present(pickerController, animated: true, completion: nil)
}
extension PostVC : UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let videoUrl = info[UIImagePickerController.InfoKey.mediaURL] as? URL {
self.videoUrl = videoUrl
print(videoUrl)
}
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
selectedImage = image
photoImageView.image = image
shareButton.isEnabled = true
}
dismiss(animated: true, completion: nil)
}
}
All I see is this:
Oh and once I select "Choose", you cannot hit anything else. The UI is stuck completely.
It seems that the issue is within the simulator. I ran the app on my iPhone and it chooses and compresses the video without any problem.