我正在制作一个应用程序,我想从iPad的视频中导入视频。
可以在iOS设备上访问视频应用吗?
注意我不是在谈论照片库或相机胶卷。
答案 0 :(得分:1)
通过此代码,您可以获取设备的照片库视频,但不能获取内置视频应用。
目标C
-(BOOL)startMediaBrowserFromViewController:(UIViewController*)controller usingDelegate:(id )delegate {
if (([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum] == NO)
|| (delegate == nil)
|| (controller == nil)) {
return NO;
}
UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
mediaUI.delegate = delegate;
[mediaUI setMediaTypes:[NSArray arrayWithObject:(NSString *)kUTTypeMovie]];
[controller presentViewController:mediaUI animated:YES completion:nil];
return YES;
}
Swift 4.2
func startMediaBrowser(from controller: UIViewController?, usingDelegate delegate: Any?) -> Bool {
if (UIImagePickerController.isSourceTypeAvailable(.savedPhotosAlbum) == false) || (delegate == nil) || (controller == nil) {
return false
}
let mediaUI = UIImagePickerController()
mediaUI.delegate = delegate as? (UIImagePickerControllerDelegate & UINavigationControllerDelegate)
mediaUI.mediaTypes = ["kUTTypeImage"]
controller?.present(mediaUI, animated: true)
return true
}