Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Burst Mode photos in library

Tags:

I’m trying to access photos in the iOS asset library that the user has taken using Burst Mode. I’m trying using ALAssetsLibrary and filtering photos:

- (void)findBurstModePhotos {     ALAssetsFilter *allPhotos = [ALAssetsFilter allPhotos];      ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init];      [assetLibrary enumerateGroupsWithTypes:ALAssetsGroupAll                                 usingBlock:^(ALAssetsGroup *group,                                              BOOL *stop) {                                     [group setAssetsFilter:allPhotos];                                      NSLog(@"Group: %@",                                           [group valueForProperty:                                            ALAssetsGroupPropertyName]);                                      if ([group numberOfAssets] > 0) {                                         [self evaluateGroup:group];                                     }                                 }                               failureBlock:^(NSError *error) {                                   NSLog(@"Failure enumerating groups: %@",                                         [error localizedDescription]);                               }]; }  - (void)evaluateGroup:(ALAssetsGroup *)group {     [group enumerateAssetsUsingBlock:^(ALAsset *result,                                        NSUInteger index,                                        BOOL *stop) {         NSLog(@"Photo date: %@", [result valueForProperty:ALAssetPropertyDate]);     }]; } 

Unfortunately, this returns Burst Mode photos as a single photo. Is there a supported way to get Burst Mode photos individually? I’d like to get each photo from a single Burst Mode session.

like image 877
Jeff Kelley Avatar asked Dec 10 '13 02:12

Jeff Kelley


People also ask

How do I retrieve burst photos?

Scroll down to find “Bursts” then tap to open the Bursts folder. Tap the photo you want to review, and then tap “Select…” at the bottom of the screen. Thumbnails of all the photos appear at the bottom of the screen. Swipe through them all to see which you like.

How do you see burst photos on iPhone?

To shoot a burst of photos, just hold your finger down on the shutter release button on your iPhone camera as you take a photo. You can review a burst series by tapping "Select…" at the bottom of the burst photo, where you can save the best individual photos or keep the entire series.

What happened to bursts on iPhone?

See, the 2019 iPhones don't implement burst mode the same as the rest of the iPhone family. While your iPhone XS and earlier require a simple long-press of the shutter button to activate burst mode, that action now triggers QuickTake, Apple's new way to shoot video directly from photo mode.


1 Answers

From my understandings, the Burst Mode photos will be added to the library as one by one.The ALAssetProperty type of each image will be ALAssetTypePhoto.So you can get each photo separately using the below ALAsset block. You can't retrieve only the set of Burst Mode photos at a time because there are only 7 types of ALAssetsGroupTypes and 3 kinds of ALAssetsFilters are available. None of them are dealing with Burst Mode photos.

I hope Apple will provide Burst photo filtering in the future.

---------------------------- ALAssetsGroupType -------------------------------------------  ALAssetsGroupLibrary      // The Library group that includes all assets. ALAssetsGroupAlbum        // All the albums synced from iTunes or created on the device. ALAssetsGroupEvent        // All the events synced from iTunes. ALAssetsGroupFaces        // All the faces albums synced from iTunes. ALAssetsGroupSavedPhotos  // The Saved Photos album. ALAssetsGroupPhotoStream  // The PhotoStream album. ALAssetsGroupAll          // The same as ORing together all the available group types,with the exception that ALAssetsGroupLibrary is not included.   -------------------------- ALAssetsFilter ------------------------------------------------  + (ALAssetsFilter *)allPhotos; // Get all photos assets in the assets group. + (ALAssetsFilter *)allVideos; // Get all video assets in the assets group. + (ALAssetsFilter *)allAssets; // Get all assets in the group. 

Use the below code to get each photo separately including the Burst Mode photos,

- (void)findBurstModePhotos {     ALAssetsLibrary *assetLibrary = [ViewController defaultAssetsLibrary];      [assetLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop)     {     [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {        if(result)       {         [self evaluateGroup:group];       }      }];      } failureBlock:^(NSError *error) {         NSLog(@"Error loading images %@", error);     }]; }  - (void)evaluateGroup:(ALAssetsGroup *)group {     [group enumerateAssetsUsingBlock:^(ALAsset *result,                                        NSUInteger index,                                        BOOL *stop) {         NSLog(@"Photo date: %@", [result valueForProperty:ALAssetPropertyDate]);     }]; }  + (ALAssetsLibrary *)defaultAssetsLibrary {     static dispatch_once_t pred = 0;     static ALAssetsLibrary *library = nil;     dispatch_once(&pred, ^{         library = [[ALAssetsLibrary alloc] init];     });     return library; } 

Output Log:

Photo date: 2013-05-06 15:57:21 +0000 //non burst image. Photo date: 2013-05-06 15:57:41 +0000 //non burst image. Photo date: 2013-12-20 21:10:40 +0000 //burst image. Photo date: 2013-12-20 21:10:41 +0000 //burst image. Photo date: 2013-12-20 21:10:41 +0000 //burst image. Photo date: 2013-12-20 21:10:41 +0000 //burst image. Photo date: 2013-12-20 21:10:41 +0000 //burst image. Photo date: 2013-12-20 21:10:42 +0000 //burst image. Photo date: 2013-12-20 21:10:42 +0000 //burst image. Photo date: 2013-12-20 21:10:42 +0000 //burst image. Photo date: 2013-12-20 21:10:43 +0000 //burst image. Photo date: 2013-12-20 21:10:43 +0000 //burst image. Photo date: 2013-12-20 21:10:43 +0000 //burst image. Photo date: 2013-12-20 21:10:44 +0000 //burst image. Photo date: 2013-12-20 21:10:44 +0000 //burst image. Photo date: 2013-12-20 21:10:44 +0000 //burst image. Photo date: 2013-12-20 21:10:44 +0000 //burst image. Photo date: 2013-12-20 21:10:45 +0000 //burst image. Photo date: 2013-12-20 21:10:45 +0000 //burst image. Photo date: 2013-12-20 21:10:45 +0000 //burst image. Photo date: 2013-12-20 21:10:45 +0000 //burst image. Photo date: 2013-12-20 21:10:46 +0000 //burst image. 

Note:

If the Burst Mode photo capture camera is a part of your application,then store the ALAsset URL's when saving the captured photos to the photo gallery.You can retrieve this photo back using the saved ALAsset URL's via ALAsset library.

like image 104
Shamsudheen TK Avatar answered Sep 27 '22 02:09

Shamsudheen TK