asAstroMediaItem

fun MediaItem.asAstroMediaItem(mapExtras: (key: String, value: String) -> Any): AstroMediaItem?

Attempts to convert a platform-specific MediaItem object to an AstroMediaItem object.

This function takes an optional mapExtras lambda function (defaulting to null). The mapExtras function is used to process any extra data associated with the MediaItem object. It takes a key-value pair (both strings) as input and should return a value in a format suitable for the AstroMediaItem object. The conversion process likely involves:

The function returns a nullable AstroMediaItem object. If the conversion fails (e.g., due to missing information or incompatible data), it returns null.

Return

An AstroMediaItem object representing the converted media item, or null if conversion fails.

Parameters

mapExtras

An optional lambda function to process platform-specific extra data from the MediaItem (default: null).