如何在Swift中5秒后自动停止视频录制?

时间:2018-12-04 05:23:00

标签: ios swift xcode uiimagepickercontroller ios12

嗨,我正在使用var imagePicker:UIImagePickerController!实例捕获视频5秒钟,但在一秒钟后停止了。

该如何解决?

在此先感谢您的帮助。

func startCameraFromViewController(type:PickerMode, viewController: UIViewController, withDelegate delegate: UIImagePickerControllerDelegate & UINavigationControllerDelegate) -> Bool {
    if UIImagePickerController.isSourceTypeAvailable(.camera) == false {
        return false
    }

    pickerMode = type
    self.imagePicker = UIImagePickerController()
    imagePicker.sourceType = .camera
    imagePicker.mediaTypes = [kUTTypeMovie as NSString as String]
    imagePicker.allowsEditing = false
    imagePicker.delegate = self
    imagePicker.videoMaximumDuration = 5
}

0 个答案:

没有答案