如何在ios中仅显示来自photolibrary的视频

时间:2016-01-13 07:17:31

标签: ios video uiimagepickercontroller

我正在开发iOS应用。我想从iPhone库中选择一些视频。我已经完成了如下代码,但它也加载了照片库中的照片。我的需要是只在设备上加载视频(不仅仅是VIDEOS上的照片)。那么有人可以帮助我为这个目标做出哪些改变吗?我的代码如下:

UIAlertAction *Gallery = [UIAlertAction actionWithTitle:@"Add Existing Video" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
    [alertcontroller dismissViewControllerAnimated:YES completion:nil];
    //VideoViewController *videoVC = [[VideoViewController alloc] init];

    self.picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    //videoVC.sourceType = picker.sourceType;

    self.picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];

    NSArray *sourceTypes = [CustomCamera availableMediaTypesForSourceType:self.picker.sourceType];
    //videoVC.pickerController = picker;
    if (![sourceTypes containsObject:(NSString *)kUTTypeMovie ])
    {
        UIAlertView *alert =[[UIAlertView alloc] initWithTitle:nil message:@"No Video available" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [alert show];
    }
    else
    {
        [self presentViewController:self.picker animated:YES completion:nil];
    }
}];

0 个答案:

没有答案