MediaMetadataRetriever.GetFrameAtTime Method

Definition

Overloads

GetFrameAtTime(Int64)

Call this method after setDataSource().

GetFrameAtTime(Int64, Option)

This method is similar to #getFrameAtTime(long, int, BitmapParams) except that the device will choose the actual Bitmap.Config to use.

GetFrameAtTime(Int64, Int32)
GetFrameAtTime(Int64, Option, MediaMetadataRetriever+BitmapParams)

Call this method after setDataSource().

GetFrameAtTime(Int64)

Call this method after setDataSource().

[Android.Runtime.Register("getFrameAtTime", "(J)Landroid/graphics/Bitmap;", "GetGetFrameAtTime_JHandler")]
public virtual Android.Graphics.Bitmap? GetFrameAtTime (long timeUs);
[<Android.Runtime.Register("getFrameAtTime", "(J)Landroid/graphics/Bitmap;", "GetGetFrameAtTime_JHandler")>]
abstract member GetFrameAtTime : int64 -> Android.Graphics.Bitmap
override this.GetFrameAtTime : int64 -> Android.Graphics.Bitmap

Parameters

timeUs
Int64

The time position where the frame will be retrieved. When retrieving the frame at the given time position, there is no guarentee that the data source has a frame located at the position. When this happens, a frame nearby will be returned. If timeUs is negative, time position and option will ignored, and any frame that the implementation considers as representative may be returned.

Returns

A Bitmap of size dst_widthxdst_height containing a representative video frame, which can be null, if such a frame cannot be retrieved.

Attributes

Remarks

Call this method after setDataSource(). This method finds a representative frame close to the given time position if possible, and returns it as a bitmap. Call this method if one does not care how the frame is found as long as it is close to the given time; otherwise, please call #getFrameAtTime(long, int).

If you don't need a full-resolution frame (for example, because you need a thumbnail image), use #getScaledFrameAtTime getScaledFrameAtTime() instead of this method.

Java documentation for android.media.MediaMetadataRetriever.getFrameAtTime(long).

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.

See also

  • <xref:Android.Media.MediaMetadataRetriever.GetFrameAtTime(System.Int64%2c+Android.Media.Option)>

Applies to

GetFrameAtTime(Int64, Option)

This method is similar to #getFrameAtTime(long, int, BitmapParams) except that the device will choose the actual Bitmap.Config to use.

[Android.Runtime.Register("getFrameAtTime", "(JI)Landroid/graphics/Bitmap;", "GetGetFrameAtTime_JIHandler")]
public virtual Android.Graphics.Bitmap? GetFrameAtTime (long timeUs, Android.Media.Option option);
[<Android.Runtime.Register("getFrameAtTime", "(JI)Landroid/graphics/Bitmap;", "GetGetFrameAtTime_JIHandler")>]
abstract member GetFrameAtTime : int64 * Android.Media.Option -> Android.Graphics.Bitmap
override this.GetFrameAtTime : int64 * Android.Media.Option -> Android.Graphics.Bitmap

Parameters

timeUs
Int64

The time position where the frame will be retrieved. When retrieving the frame at the given time position, there is no guarantee that the data source has a frame located at the position. When this happens, a frame nearby will be returned. If timeUs is negative, time position and option will ignored, and any frame that the implementation considers as representative may be returned.

option
Option

a hint on how the frame is found. Use #OPTION_PREVIOUS_SYNC if one wants to retrieve a sync frame that has a timestamp earlier than or the same as timeUs. Use #OPTION_NEXT_SYNC if one wants to retrieve a sync frame that has a timestamp later than or the same as timeUs. Use #OPTION_CLOSEST_SYNC if one wants to retrieve a sync frame that has a timestamp closest to or the same as timeUs. Use #OPTION_CLOSEST if one wants to retrieve a frame that may or may not be a sync frame but is closest to or the same as timeUs. #OPTION_CLOSEST often has larger performance overhead compared to the other options if there is no sync frame located at timeUs.

Returns

A Bitmap containing a representative video frame, which can be null, if such a frame cannot be retrieved. Bitmap#getConfig() can be used to query the actual Bitmap.Config.

Attributes

Remarks

This method is similar to #getFrameAtTime(long, int, BitmapParams) except that the device will choose the actual Bitmap.Config to use.

Java documentation for android.media.MediaMetadataRetriever.getFrameAtTime(long, int).

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.

Applies to

GetFrameAtTime(Int64, Int32)

public Android.Graphics.Bitmap? GetFrameAtTime (long timeUs, int option);
member this.GetFrameAtTime : int64 * int -> Android.Graphics.Bitmap

Parameters

timeUs
Int64
option
Int32

Returns

Remarks

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.

Applies to

GetFrameAtTime(Int64, Option, MediaMetadataRetriever+BitmapParams)

Call this method after setDataSource().

[Android.Runtime.Register("getFrameAtTime", "(JILandroid/media/MediaMetadataRetriever$BitmapParams;)Landroid/graphics/Bitmap;", "GetGetFrameAtTime_JILandroid_media_MediaMetadataRetriever_BitmapParams_Handler", ApiSince=30)]
public virtual Android.Graphics.Bitmap? GetFrameAtTime (long timeUs, Android.Media.Option option, Android.Media.MediaMetadataRetriever.BitmapParams params);
[<Android.Runtime.Register("getFrameAtTime", "(JILandroid/media/MediaMetadataRetriever$BitmapParams;)Landroid/graphics/Bitmap;", "GetGetFrameAtTime_JILandroid_media_MediaMetadataRetriever_BitmapParams_Handler", ApiSince=30)>]
abstract member GetFrameAtTime : int64 * Android.Media.Option * Android.Media.MediaMetadataRetriever.BitmapParams -> Android.Graphics.Bitmap
override this.GetFrameAtTime : int64 * Android.Media.Option * Android.Media.MediaMetadataRetriever.BitmapParams -> Android.Graphics.Bitmap

Parameters

timeUs
Int64
option
Option

Returns

A Bitmap containing a representative video frame, which can be null, if such a frame cannot be retrieved.

Attributes

Remarks

Java documentation for android.media.MediaMetadataRetriever.getFrameAtTime().

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.

Applies to