Objective c 在uitableviewcell中列出所有视频(来自照片库和视频应用程序)

Objective c 在uitableviewcell中列出所有视频(来自照片库和视频应用程序),objective-c,uitableview,alassetslibrary,alasset,mpmediaquery,Objective C,Uitableview,Alassetslibrary,Alasset,Mpmediaquery,我想列出所有的视频。不仅仅是照片库中的视频,还有视频应用程序中的视频,包括电影、电视节目、音乐视频等 当我使用这样的设置时: ALAsset *asset = [videoLibrary objectAtIndex:indexPath.row]; videoURL = [[asset defaultRepresentation] url]; [videoURLs addObject:videoURL]; [cell.textLabel setText:[NSString stringWithFo

我想列出所有的视频。不仅仅是照片库中的视频,还有视频应用程序中的视频,包括电影、电视节目、音乐视频等

当我使用这样的设置时:

ALAsset *asset = [videoLibrary objectAtIndex:indexPath.row];
videoURL = [[asset defaultRepresentation] url];
[videoURLs addObject:videoURL];
[cell.textLabel setText:[NSString stringWithFormat:@"Video %d", indexPath.row+1]];
[cell.imageView setImage:[UIImage imageWithCGImage:[asset thumbnail]]];
在(UITableViewCell*)tableView:cellForRowAtIndexPath:方法中,仅显示照片库中的视频。有没有办法得到所有的类型


提前感谢

我想您需要在您的IOS设备上检索所有视频,您可以找到相同的代码

调度异步(调度获取全局队列(调度队列优先级默认为0)^{


这不会从视频应用程序中提取视频。它将仅从照片库(iPod库)获取所有视频,而不会从其他应用程序获取所有视频。-祝你好运
    NSMutableArray *assetGroups = [[NSMutableArray alloc] init];
    NSMutableArray *assetURLDictionaries = [[NSMutableArray alloc] init];

    // Process assets
    void (^assetEnumerator)(ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) {
        if (result != nil) {   
           if([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo]){
                [assetURLDictionaries addObject:[result valueForProperty:ALAssetPropertyURLs]];
                NSURL *url = result.defaultRepresentation.url;
                [assetLibrary assetForURL:url
                              resultBlock:^(ALAsset *asset) {
                                  if (asset) {
                                      @synchronized(assets) {
                                          [systemVideoArray addObject:asset];
                                          [self.mTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
                                      }
                                  }
                              }
                             failureBlock:^(NSError *error){
                                 NSLog(@"operation was not successfull!");
                             }];
            }
        }
    };