Use ELCImagePickerController to pick video

后端 未结 2 1038
无人及你
无人及你 2020-12-11 05:23

I am trying to pick video by ELCImagePickerController from photo library, but when I print this

NSLog(@\"%@\",[dict valueForKey:@\"UIImagePicker         


        
相关标签:
2条回答
  • 2020-12-11 05:43

    We need to replace "allPhotos" with "allAssets" in ALAssetsFilter at
    two place to show all asset (including video ) in ELCImagePickerController code
    as given below

    First change :

    ALAssetsGroup *g = (ALAssetsGroup*)[assetGroups objectAtIndex:indexPath.row]; 
    [g setAssetsFilter:[ALAssetsFilter **allAssets**]];
    

    Second :

    In tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath method

    [picker.assetGroup setAssetsFilter:[ALAssetsFilter **allAssets**]];
    

    But video asset thumbnail will be same as image thumbnail , to change it write custom code in ELCAsset.m class constructor initWithAsset:(ALAsset*)_asset

    For example :

    check

    if ([self.asset valueForProperty:ALAssetPropertyType] == ALAssetTypeVideo ){
                     // code for video thumbnail 
          }
    
    if ([self.asset valueForProperty:ALAssetPropertyType] == ALAssetTypePhoto ){
                 // code for Photo thumbnail 
        }
    
    0 讨论(0)
  • 2020-12-11 05:50

    Change ALAssetsGroup filter to allAssets in ELCAlbumPickerController.m file:

    here:

     ALAssetsGroup *g = (ALAssetsGroup*)[assetGroups objectAtIndex:indexPath.row];
        [g setAssetsFilter:[ALAssetsFilter allPhotos]];
    

    and here:

    [picker.assetGroup setAssetsFilter:[ALAssetsFilter allPhotos]];
    
    0 讨论(0)
提交回复
热议问题