Ios 如何使用;使用视频";/&引用;选择「;swift 3中的视频按钮?
我正在尝试将从库中选择的视频或从摄像头录制的视频上传到firebase。当我从库中获取视频时,图像选择器上有一个“选择”按钮,或者当我录制视频时,它会显示“使用视频”。 我认为要运行这些按钮功能,您必须编写didFinishPickingMediaWithInfo函数。但当我录制视频并单击“选择”时,什么也不会发生这是我的代码:Ios 如何使用;使用视频";/&引用;选择「;swift 3中的视频按钮?,ios,swift,xcode,firebase,video,Ios,Swift,Xcode,Firebase,Video,我正在尝试将从库中选择的视频或从摄像头录制的视频上传到firebase。当我从库中获取视频时,图像选择器上有一个“选择”按钮,或者当我录制视频时,它会显示“使用视频”。 我认为要运行这些按钮功能,您必须编写didFinishPickingMediaWithInfo函数。但当我录制视频并单击“选择”时,什么也不会发生这是我的代码: if (UIImagePickerController.isSourceTypeAvailable(.camera)) {
if (UIImagePickerController.isSourceTypeAvailable(.camera)) {
if UIImagePickerController.availableCaptureModes(for: .rear) != nil {
//if the camera is available, and if the rear camera is available, the let the image picker do this
imagePicker.sourceType = .camera
imagePicker.mediaTypes = [kUTTypeMovie as String]
imagePicker.allowsEditing = false
imagePicker.delegate = self as? UIImagePickerControllerDelegate & UINavigationControllerDelegate
imagePicker.videoMaximumDuration = 60
imagePicker.videoQuality = .typeIFrame1280x720
present(imagePicker, animated: true, completion: nil)
} else {
postAlert("Rear camera doesn't exist", message: "Application cannot access the camera.")
}
} else {
postAlert("Camera inaccessable", message: "Application cannot access the camera.")
}
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
print("didFinishPickingMediaWithInfo")
}
我希望它至少打印出来,以知道视频“选择按钮”正在工作。关于如何让“选择”按钮工作有什么想法吗?任何帮助都会很好。提前谢谢你 您是否尝试过在类标题中采用
UIImagePickerControllerDelegate
和UINavigationControllerDelegate
,并设置imagePicker。将委派给self
,而不是每次演示picker之前都这样做?您是否尝试过采用UIImagePickerControllerDelegate
和UINavigationControllerDelegate
在类标题中,并设置imagePicker。是否将委派给self
而不是每次在演示picker之前都这样做?