asNativeMediaItem

fun AstroMediaItem.asNativeMediaItem(metadata: MediaMetadata? = this.metadata?.asNativeMediaMetadata()): MediaItem

Converts an AstroMediaItem object to a platform-specific MediaItem object suitable for the underlying media player.

This function takes an optional metadata argument (defaulting to the metadata property of the current AstroMediaItem after conversion using asNativeMediaMetadata() if available). It internally uses the asNativeMediaItemBuilder function to create a builder, populates it with the media ID, source URI (converted to an Android URI using toAndroidUri()), and optionally the media metadata (if provided), and then builds the final MediaItem object.

Return

A MediaItem object suitable for the underlying media player.

Parameters

metadata

An optional MediaMetadata object representing the media metadata in a format compatible with the underlying media player (defaults to the converted metadata from the current AstroMediaItem).