alasset

How to play multiple videos smoothly in iOS in UICollectionView?

只谈情不闲聊 提交于 2019-12-05 16:19:09
I want to play multiple videos in infinite loop in my collection view. Each Video represent a cell. I am using ALAsset. I am playing this using AVPLayer but it's not loading and playing smoothly. Any Suggestions. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath]; CGRect attachmentFrame = CGRectMake(2, 2, cell.frame.size.width-4, cell.frame.size.height-4); ALAsset *asset = self.assets[indexPath

Read images from a iphone album using ALAssetsLibrary

浪尽此生 提交于 2019-12-05 12:30:29
I am trying to write a method that read assets from a album I am getting all images from all album using ALAsset, my question is how can I customize this method to read images from myAlbum /** * This method is used to get all images from myAlbum * folder in device if getAlbumImages is set to 1 * else loads all images from devices library */ -(void)readImages:(int)getAlbumImages { imageArray = [[NSArray alloc] init]; mutableArray =[[NSMutableArray alloc]init]; NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init]; library = [[ALAssetsLibrary alloc] init]; if(getFolderImages == 1)

PHAsset (or ALAsset) cross-device identifier

巧了我就是萌 提交于 2019-12-05 09:54:00
I am actually creating an iOS app, and want to store some details about Photo Library pictures in an SQLite database. I also would like to be able to share this data across the different devices the user has (imagine someone wanted to reorganize pictures on his iPhone, and wants to retrieve the same order in his iPad). I have searched across the Apple documentation, but did not find any PHAsset identifier that is shared across devices. I also tried to check if the PHImageFileURLKey , hashValue , or localIdentifier of the PHAsset where shared, but none of them are. Has someone already done

Possible ways to speed up reading from ALAssetsLibrary and populating a UITableView

孤人 提交于 2019-12-05 07:55:23
问题 Right now, I am using the ALAssetsLibrary to gather the photos from ALAssetsGroupSavedPhotos and ALAssetsGroupLibrary. Upon reading all the assets into an array, I populate my UITableView ([myTable reloadData]) to show the photos. I find that if the user has many photos, there is an increasing amount of delay. Is there any way to possible speed things up? The default UIIMagePicker seems to have no delay at all, despite the number of photos in the Camera Roll or PhotoLibrary. Is there any way

How to enumerate all photos on iOS 8 using ALAssetsLibrary

半世苍凉 提交于 2019-12-05 04:42:52
iOS 8 broke lots of apps by removing "Camera Roll" from the ALAssetsLibrary enumerating API. I know I can get all photos using the new Photos framework. But my app has a lot of code depending on ALAsset related classes and I need to keep iOS 7 support. Is there a way to enumerate all photos using ALAssetsLibary on iOS 8, without enumerating asset group first? Apple just released 8.0.1 and listed this as a included fix. Might just be best to wait for that. From the 8.0.1 release notes: Fixes an issue that prevented some apps from accessing photos from the Photo Library 来源: https://stackoverflow

How to copy an image file from iOS Photo Library (ALAssetsLibrary) to the local directory of an App?

旧城冷巷雨未停 提交于 2019-12-04 11:34:51
I can get images from Photo Library through ALAssetsLibrary: void (^assetEnumerator)(ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop){ if([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto]) { // Copy the photo image to the `/Documents` directory of this App here } }; void (^assetGroupEnumerator )(ALAssetsGroup*, BOOL*) = ^(ALAssetsGroup *group, BOOL *stop){ if (group != nil) { [group enumerateAssetsUsingBlock:assetEnumerator]; } }; // fetch ALAssetsLibrary *library = [ALAssetsLibrary new]; [library enumerateGroupsWithTypes

Get MIME type of an ALAsset

我的未来我决定 提交于 2019-12-04 03:57:11
问题 Is there a way how to get MIME type for ALAsset? There is a nice method for metadata: NSDictionary *data = [[asset defaultRepresentation] metadata]; But that doesn't contain MIME type data... 回答1: ALAssetRepresentation *rep = [asset defaultRepresentation]; NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass ((__bridge CFStringRef)[rep UTI], kUTTagClassMIMEType); This will give you the MIME type. You need to add MobileCoreService framework and import

Possible ways to speed up reading from ALAssetsLibrary and populating a UITableView

落花浮王杯 提交于 2019-12-03 23:10:29
Right now, I am using the ALAssetsLibrary to gather the photos from ALAssetsGroupSavedPhotos and ALAssetsGroupLibrary. Upon reading all the assets into an array, I populate my UITableView ([myTable reloadData]) to show the photos. I find that if the user has many photos, there is an increasing amount of delay. Is there any way to possible speed things up? The default UIIMagePicker seems to have no delay at all, despite the number of photos in the Camera Roll or PhotoLibrary. Is there any way to attain the same speed? Thank you! Just enumerate the assets you currently need to display by using

Error trying to assigning __block ALAsset from inside assetForURL:resultBlock:

放肆的年华 提交于 2019-12-03 16:56:28
I am trying to create a method that will return me a ALAsset for a given asset url. (I need upload the asset later and want to do it outside the result block with the result.) + (ALAsset*) assetForPhoto:(Photo*)photo { ALAssetsLibrary* library = [[[ALAssetsLibrary alloc] init] autorelease]; __block ALAsset* assetToReturn = nil; NSURL* url = [NSURL URLWithString:photo.assetUrl]; NSLog(@"assetForPhoto: %@[", url); [library assetForURL:url resultBlock:^(ALAsset *asset) { NSLog(@"asset: %@", asset); assetToReturn = asset; NSLog(@"asset: %@ %d", assetToReturn, [assetToReturn retainCount]); }

How to get all photos moment wise using ALAssetLibrary in ios7?

烈酒焚心 提交于 2019-12-01 23:41:10
问题 I have problem to get photos in moment wise like apple iphone have in ios8. I have implemented for ios8 using PHAsset and Photos.framework. Now, when i run same code in ios7 device then it returns nothing. So, i go with ALAssetLibrary to get photos. Using ALAssetLibrary i also got all photos but that are like albums wise photos. and also using this ALAssetLibrary i cannot get album creation date not its location name, as i have to show this to data on my each section's header. My code for