I'm having trouble trying to display video I just recorded in an image view. It's pretty simple to display an image in an image view but I don't know where to start. This is all I have so far:
import UIKit
import AVKit
import AVFoundation
import MobileCoreServices
class VideoViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@IBOutlet weak var videoImageView: UIImageView!
override func viewWillAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if self.isBeingPresented || self.isMovingToParentViewController {
let imagePicker = UIImagePickerController()
imagePicker.sourceType = .camera
imagePicker.mediaTypes = [kUTTypeMovie as String]
imagePicker.allowsEditing = false
imagePicker.delegate = self
present(imagePicker, animated: true, completion: {})
}
}
}
I can open the video camera and record then do the action "use video". But once I do that I'm returned to the view controller with nothing in the UIImageView. I know I haven't stored the information in a data but I haven't seen anything online that'll help me with that. I'd appreciate any advice on this. Thanks.