CloudMediaProvider.OnOpenPreview Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a descriptor for a preview of the specified media item.
[Android.Runtime.Register("onOpenPreview", "(Ljava/lang/String;Landroid/graphics/Point;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;", "GetOnOpenPreview_Ljava_lang_String_Landroid_graphics_Point_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=33)]
public abstract Android.Content.Res.AssetFileDescriptor OnOpenPreview(string mediaId, Android.Graphics.Point size, Android.OS.Bundle? extras, Android.OS.CancellationSignal? signal);
[<Android.Runtime.Register("onOpenPreview", "(Ljava/lang/String;Landroid/graphics/Point;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;", "GetOnOpenPreview_Ljava_lang_String_Landroid_graphics_Point_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=33)>]
abstract member OnOpenPreview : string * Android.Graphics.Point * Android.OS.Bundle * Android.OS.CancellationSignal -> Android.Content.Res.AssetFileDescriptor
Parameters
- mediaId
- String
the media item to return
- size
- Point
the requested dimensions when returning a thumbnail. The thumbnail doesn't
have to match the size precisely because the OS will adjust the dimensions before
usage. Implementations can return close approximations especially if the approximation is
already locally on the device and doesn't require downloading from the cloud.
- extras
- Bundle
Options that control how the descriptor is opened. For a video, when
ExtraPreviewThumbnail is
true, return a thumbnail image; when it is false or
absent, return a descriptor for the media file. Returning the wrong kind may cause
unexpected preview behavior in the photo picker.
- signal
- CancellationSignal
used by the OS to signal if the request should be cancelled
Returns
A read-only asset file descriptor for the requested preview.
- Attributes
Remarks
Returns a descriptor for a preview of the specified media item.
For an image thumbnail, the cloud media provider should use the original MIME type of the item.
A thumbnail is expected to be a much lower resolution version than the item returned by #onOpenMedia.
If you block while downloading content, you should periodically check CancellationSignal#isCanceled() to abort abandoned open requests.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.