2012-06-05 71 views
0

您好,我正在从ALAsset库中获取所有照片和视频缩略图。
我的代码工作正常我得到照片和视频缩略图。但在视频缩略图中缺少视频图标和它的时间戳。
ALAsset中缺少视频文件缩略图时间戳

[assetImageView setImage:[UIImage imageWithCGImage:[self.asset thumbnail]]]; 

enter image description here


我得到像above..i正在使用ELCImagePickerDemp API

enter image description here


我需要得到这样的我缺少时间并在右下角thumbnai图标湖任何帮助将不胜感激...... THX

回答

2

您注意到的assetslibrary缩略图不包括缩略图中的符号和时间信息。所以你必须使用你从Alassetslibrary得到的信息来绘制你自己的缩略图(检查ALAssetPropertyType和ALAseetPropertyDuration以获得你自己绘制这些信息所需的信息)。

干杯,

亨德里克

+0

ok thx ..如果你有任何链接,你可以分享我的视频图标和时间缩略图图标底部 –

0

替换代码形式过滤器 “allPhotos” 在两个地 “allAssets” 在 ELCAlbumPickerController.m

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

        // replace [g setAssetsFilter:[ALAssetsFilter allPhotos]]; as it filter only photo 
        [g setAssetsFilter:[ALAssetsFilter allAssets]]; //gives allassets 
} 

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

// replace [picker.assetGroup setAssetsFilter:[ALAssetsFilter allPhotos]]; as it filer only photo 
    **[picker.assetGroup setAssetsFilter:[ALAssetsFilter allAsset]];** // gives allassets 
} 

现在所有资产会显示在库中。为了区分视频和图像缩略图,您现在必须在构造中添加一些代码ELCAsset.m类r

-(id)initWithAsset:(ALAsset*)asset_ { 
if ([self.asset valueForProperty:ALAssetPropertyType] == ALAssetTypeVideo){ 
     // code for video thumbnail 
     // you can use this link to understand video thumbnail 
    //http://stackoverflow.com/questions/11688938/alasset-thumbnail-at-specific-timestamp 
} 

    if ([self.asset valueForProperty:ALAssetPropertyType] == ALAssetTypePhoto){ 
      // code for Photo thumbnail 
    } 

}