从相机胶卷中选择视频

时间:2018-02-01 20:02:40

标签: ios swift

我不知道如何在iOS中使用Swift从相机胶卷中选择视频。我正在制作一个Instagram app克隆,我希望用户只能从他们的相机胶卷中选择视频。

我在google上搜索了这个问题,但只找到了解释如何从相机胶卷中选择图像的教程。

1 个答案:

答案 0 :(得分:0)

您可以使用:

func getMovie() {
    let selecionadorDeFoto = UIImagePickerController()
    selecionadorDeFoto.delegate = self

    selecionadorDeFoto.mediaTypes = [kUTTypeMovie as String]

    selecionadorDeFoto.allowsEditing = false

    selecionadorDeFoto.sourceType = .photoLibrary

    present(selecionadorDeFoto, animated: true, completion: nil)
}

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

    // Your code here
}
相关问题