Я пытаюсь получить выбранное видео из приложения iOS с помощью UIImagePickerController, и пока нажата кнопка, он отлично прекращает работу с PhotoLibrary, и я выбираю видео, и он говорит compressing video
, поэтому он действует как его выбор, но после этого ничего не происходит. И я действительно не могу понять, почему.Получение видео с помощью UIImagePickerController
var picker = UIImagePickerController()
var imag = UIImagePickerController()
...
@IBAction func selectMediaAction(sender: UIButton) {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){
picker.delegate = self
picker.allowsEditing = false
picker.mediaTypes = [kUTTypeMovie as String]
self.presentViewController(picker, animated: true, completion: nil)
}
}
func imagePickerController(picker: UIImagePickerController!, didFinishPickingImage image: UIImage!, editingInfo: NSDictionary!) {
let media = editingInfo[UIImagePickerControllerOriginalImage]
let imageURL = media?.filePathURL as NSURL?
mediaPath = imageURL
mediaName.text = imageURL!.lastPathComponent
self.dismissViewControllerAnimated(true, completion: nil)
toggleSubmit()
}
@IBAction func createMediaAction(sender: UIButton) {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
imag.delegate = self
imag.allowsEditing = false
imag.sourceType = UIImagePickerControllerSourceType.Camera
imag.mediaTypes = [kUTTypeMovie as String]
self.presentViewController(imag, animated: true, completion: nil)
} else{
let alert = UIAlertController(title: nil, message: "There is no camera available on this device", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
}
}
Я что-то не хватает? Мне кажется, что он должен работать