Show Live Photos in your Xojo application

Have you tried our recent Photos classes addition to MBS Xojo Plugins?

You can use PHPhotoLibraryMBS class to check your authorization status and ask the user for permissions to access the photo library. Once allowed, you can use fetchAssetCollectionsWithType shared method in PHAssetCollectionMBS class to query the assertion collections. Pick one PHAssetCollectionMBS and then use fetchAssetsInAssetCollection shared method in PHAssetMBS class. Then you get a PHFetchResultMBS, which is basically a kind of record set with data. This may contain PHAssetMBS objects in this case and read the properties there.

When you have the asset, check mediaSubtypes bitmap for whether this is a video, image or Live Photo. You can use PHImageManagerMBS class with RequestImageForAsset method to request an image. There you pass a delegate method and this one is usually called twice, e.g. with a quick preview and later when full image is available. Then you can display the image. For a Live Photo you can use RequestLivePhotoForAsset method in the image method. Instead of using delegates, you can use RequestImageForAssetSync to quickly ask for a thumbnail for your convenience.

The whole API is asynchronous and uses delegates a lot. We define over 20 delegate types in the plugin. All can be used including progress delegate to show a progress dialog. Our plugin handles all the asynchronous threaded callbacks for you and makes sure all delegates are routed to main thread. Also we pass through tag parameters, so you can pass reference to your window/class to manager this.

If you like, please try our example project and let us know how it works.