问题
hi i am getting all photos and videos thumbnails from ALAsset library.
my code works fine i am getting photos and video thumbnail.but in video thumbnail missing Video icon and its time stamp.
[assetImageView setImage:[UIImage imageWithCGImage:[self.asset thumbnail]]];
i am getting like above..i am using ELCImagePickerDemp API
i need to get like this i am missing time and icon in lower right corner thumbnail. any help will be appreciated... THX
回答1:
The assetslibrary thumbnail as you noticed does not include the symbol and time information in the thumbnail. So you have to draw those yourself on the thumbnail using the information you get from Alassetslibrary (check ALAssetPropertyType and ALAseetPropertyDuration to get the info you need to draw these yourself).
Cheers,
Hendrik
回答2:
Replace filter in code form "allPhotos" with "allAssets" in two places in ELCAlbumPickerController.m class
-(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
}
now all asset will be shown in Library.To differentiate between video and image thumbnail , you now have to add some code ELCAsset.m class in constructor
-(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
}
}
来源:https://stackoverflow.com/questions/10896527/video-file-thumbnail-timestamp-missing-in-alasset