asNativeMediaItemBuilder

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

Creates a builder object for a platform-specific MediaItem compatible with the underlying media player, pre-populated with data from the current AstroMediaItem.

This function takes an optional metadata argument (defaulting to the metadata property of the current AstroMediaItem after conversion using asNativeMediaMetadata() if available). It creates a new MediaItem.Builder object and applies the following configuration:

  • If metadata is provided, it sets the media metadata using setMediaMetadata(metadata).

  • It sets the media ID using setMediaId(mediaId).

  • It sets the media source URI by converting the source property of the AstroMediaItem to an Android URI using toAndroidUri().

The resulting builder object allows further customization of the MediaItem before building the final object using build().

Return

A MediaItem.Builder object pre-populated with data from the current AstroMediaItem.

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).