mardi 4 août 2015

How can I save video to photo library?

I copied this code from a book and arrange it to my code but I have doubts how to save the videos that I'm recording. Do I need to take the video URL? if so, how can I take it? Thanks

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) { let mediaType = info[UIImagePickerControllerMediaType] as? NSString

    self.dismissViewControllerAnimated(true, completion: nil)

    if mediaType == (kUTTypeImage as! String) {
        let image = info[UIImagePickerControllerOriginalImage] as? UIImage

        imageView.image = image

        if (newMedia == true) {
            UIImageWriteToSavedPhotosAlbum(image, self, "image:didFinishSavingWithError:contextInfo:", nil)
        } else if mediaType == (kUTTypeMovie as! String) {
            //Code to support video


        }

    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire