Platforms to show: All Mac Windows Linux Cross-Platform

Back to PHImageManagerMBS class.

PHImageManagerMBS.cancelImageRequest(requestID as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Cancels an asynchronous request.

requestID: The numeric identifier of the request to be canceled.

When you perform an asynchronous request for image data using the requestImageForAsset method, or for a video object using one of the methods listed in Requesting Video Objects, the image manager returns a numeric identifier for the request. To cancel the request before it completes, provide this identifier when calling the cancelImageRequest method.

Some examples using this method:

PHImageManagerMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The constructor.

PHImageManagerMBS.RequestAVAssetForVideo(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, exportPreset as String, CompletionHandler as RequestAVAssetForVideoCompletedMBS, tag as Variant = nil) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Requests AVFoundation objects representing the video asset’s content and state, to be loaded asynchronously.

asset: The video asset for which video objects are to be loaded.
options: Options specifying how Photos should handle the request and notify your app of progress or errors. For details, see PHVideoRequestOptionsMBS class.

Returns a numeric identifier for the request. If you need to cancel the request before it completes, pass this identifier to the cancelImageRequest method.

When you call this method, Photos downloads the video data (if necessary) and creates AVFoundation objects. It then calls your resultHandler block to provide the requested video.

Use this method when you want to work with the arrangement of audio and video tracks that an asset contains. If you plan to use the asset only for playback, call the requestPlayerItemForVideo method. If you plan to export the asset data, call the requestExportSessionForVideo method.

PHImageManagerMBS.RequestExportSessionForVideo(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, exportPreset as String, CompletionHandler as RequestExportSessionForVideoCompletedMBS, tag as Variant = nil) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Requests an export session for writing the video asset’s data to a file, to be loaded asynchronously.

asset: The video asset for which an export session is to be created.
options: Options specifying how Photos should handle the request and notify your app of progress or errors. For details, see PHVideoRequestOptionsMBS.
exportPreset: The export preset name for exporting the asset. For available presets, see AVAssetExportSessionMBS.

A numeric identifier for the request. If you need to cancel the request before it completes, pass this identifier to the cancelImageRequest method.

When you call this method, Photos downloads the video data (if necessary) and creates an export session. It then calls your resultHandler delegate to provide the requested video.
For additional export options, use the requestAVAssetForVideo method and then create AVAssetReader and AVAssetWriterMBS objects to transcode and output the video asset’s data.

PHImageManagerMBS.RequestImageDataAndOrientationForAsset(asset as PHAssetMBS, options as PHImageRequestOptionsMBS, CompletionHandler as RequestImageForAssetCompletedMBS, tag as Variant = nil) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Requests the largest represented image as data bytes and EXIF orientation for the specified asset.

asset: The asset for which to load image data.
options: Options specifying how Photos should handle the request, format the requested image, and notify your app of progress or errors.

If PHImageRequestOptionsMBS.VersionCurrent is requested and the asset has adjustments, the largest rendered image data is returned. In all other cases, the original image data is returned.
For further details, see PHImageRequestOptionsMBS class.

Returns a numeric identifier for the request. If you need to cancel the request before it completes, pass this identifier to the cancelImageRequest method.

When you call this method, Photos loads the largest available representation of the image asset, then calls your resultHandler block to provide the requested data. Depending on the options you specify and the current state of the asset, Photos may download asset data from the network.

By default, this method executes asynchronously. If you call it from a background thread, you may change the synchronous property of the options parameter to true to block the calling thread until either the requested image is ready or an error occurs, at which time Photos calls your result handler. This method ignores the deliveryMode option—Photos calls your result handler block exactly once.

If the version option is set to PHImageRequestOptionsMBS.VersionCurrent, Photos provides rendered image data, including the results of any edits that have been made to the asset content. Otherwise, Photos provides the originally captured image data for the asset.

PHImageManagerMBS.RequestImageForAsset(asset as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHImageRequestOptionsMBS, CompletionHandler as RequestImageForAssetCompletedMBS, tag as Variant = nil) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Requests an image representation for the specified asset.

asset: The asset whose image data is to be loaded.
targetSize: The target size of image to be returned.
contentMode: An option for how to fit the image to the aspect ratio of the requested size. For details, see PHImageContentMode.
options: Options specifying how Photos should handle the request, format the requested image, and notify your app of progress or errors. For details, see PHImageRequestOptionsMBS class.

Returns a numeric identifier for the request. If you need to cancel the request before it completes, pass this identifier to the cancelImageRequest method.

When you call this method, Photos loads or generates an image of the asset at, or near, the size you specify. Next, it calls your resultHandler block to provide the requested image. To serve your request more quickly, Photos may provide an image that is slightly larger than the target size—either because such an image is already cached or because it can be generated more efficiently. Depending on the options you specify and the current state of the asset, Photos may download asset data from the network.

By default, this method executes asynchronously. If you call it from a background thread you may change the synchronous property of the options parameter to true to block the calling thread until either the requested image is ready or an error occurs, at which time Photos calls your result handler.

For an asynchronous request, Photos may call your result handler block more than once. Photos first calls the block to provide a low-quality image suitable for displaying temporarily while it prepares a high-quality image. (If low-quality image data is immediately available, the first call may occur before the method returns.) When the high-quality image is ready, Photos calls your result handler again to provide it. If the image manager has already cached the requested image at full quality, Photos calls your result handler only once. The PHImageResultIsDegradedKey key in the result handler’s info parameter indicates when Photos is providing a temporary low-quality image.

You can use this method for both photo and video assets — for a video asset, an image request provides a thumbnail image or poster frame.

Some examples using this method:

PHImageManagerMBS.RequestImageForAssetSync(asset as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHImageRequestOptionsMBS, byref Info as Dictionary) as NSImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Requests an image representation for the specified asset synchronously.

asset: The asset whose image data is to be loaded.
targetSize: The target size of image to be returned.
contentMode: An option for how to fit the image to the aspect ratio of the requested size. For details, see PHImageContentMode.
options: Options specifying how Photos should handle the request, format the requested image, and notify your app of progress or errors. For details, see PHImageRequestOptionsMBS class.

Returns the image.

Some examples using this method:

PHImageManagerMBS.RequestLivePhotoForAsset(asset as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHLivePhotoRequestOptionsMBS, CompletionHandler as RequestLivePhotoForAssetCompletedMBS, tag as Variant = nil) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Requests a Live Photo representation for the specified asset.

asset: The asset whose Live Photo data is to be loaded.
targetSize: The target size of Live Photo to be returned.
contentMode: An option for how to fit the image to the aspect ratio of the requested size. For details, see PHImageContentMode.
options: Options specifying how Photos should handle the request, format the requested image, and notify your app of progress or errors. For details, see PHLivePhotoRequestOptionsMBS class.

Returns a numeric identifier for the request. If you need to cancel the request before it completes, pass this identifier to the cancelImageRequest method.

A Live Photo is a picture, taken with a supported device, that includes movement and sound from the moments just before and after its capture. Much like how a UIImage object represents a ready-to-use form of an image, a PHLivePhotoMBS object represents a Live Photo whose image, motion, and sound data are prepared for display. Use this method to request an asset’s Live Photo form; after Photos calls your resultHandler delegate to provide the Live Photo, you can display it using the PHLivePhotoViewMBS class.

Use this method only when you plan to display the motion and sound content associated with a Live Photo. In contexts where you need only a still image for a Live Photo asset—for example, when loading thumbnails to display in a photo chooser interface—use the requestImageForAsset method instead.

When you call this method, Photos loads or generates a PHLivePhotoMBS object for the asset at, or near, the size you specify. Next, it calls your resultHandler block to provide the requested image. To serve your request more quickly, Photos may provide an image that is slightly larger than the target size—either because such an image is already cached or because it can be generated more efficiently. Depending on the options you specify and the current state of the asset, Photos may download asset data from the network. This method always executes asynchronously.

Photos may call your result handler block more than once. Photos first calls the block to provide a low-quality image suitable for displaying temporarily while it prepares a high-quality image. (If low-quality image data is immediately available, the first call may occur before the method returns.) When the high-quality image is ready, Photos calls your result handler again to provide it. If the image manager has already cached the requested image at full quality, Photos calls your result handler only once. The PHImageResultIsDegradedKey key in the result handler’s info parameter indicates when Photos is providing a temporary low-quality image.

Some examples using this method:

PHImageManagerMBS.RequestPlayerItemForVideo(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, CompletionHandler as RequestPlayerItemForVideoCompletedMBS, tag as Variant = nil) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Photos MBS Mac64bit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Requests a representation of the video asset for playback, to be loaded asynchronously.

asset: The video asset to be played back.
options: Options specifying how Photos should handle the request and notify your app of progress or errors. For details, see PHVideoRequestOptionsMBS.

A numeric identifier for the request. If you need to cancel the request before it completes, pass this identifier to the cancelImageRequest method.

When you call this method, Photos downloads the video data (if necessary) and creates a player item. It then calls your resultHandler block to provide the requested video.

Use this method when you want to simply play back the video asset as it currently exists. For more detailed options or to work with the asset’s audio and video tracks, use the requestAVAssetForVideo method instead.

The items on this page are in the following plugins: MBS Mac64bit Plugin.


The biggest plugin in space...