Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

open recorder with button click

I’ve button and want to open a video recorder, but my code only opens photo capture any easy solutions ?

    @IBAction func uploadVideoButton(_ sender: UIButton) {
        let vc = UIImagePickerController()
        vc.sourceType = .camera
        vc.allowsEditing = true
        vc.delegate = self
        present(vc, animated: true)
    }

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You need to tell the picker what kind of media you want.

vc.sourceType = .camera
vc.mediaTypes = [kUTTypeMovie as String]

Remember to import MobileCoreServices too.

Having just quickly tested this, kUTTypeMovie is deprecated so you should look into UTTypeMovie

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading