Artwork

Functions summary

Unit
@UnstableApi
@Composable
Artwork(
    player: Player?,
    modifier: Modifier,
    contentDescription: String?,
    alignment: Alignment,
    contentScale: ContentScale,
    alpha: Float,
    colorFilter: ColorFilter?,
    painter: @Composable CurrentMediaItemState.() -> Painter?
)

Displays the artwork of the current MediaItem from the player.

Unit
@UnstableApi
@Composable
Artwork(
    metadata: MediaMetadata?,
    modifier: Modifier,
    contentDescription: String?,
    alignment: Alignment,
    contentScale: ContentScale,
    alpha: Float,
    colorFilter: ColorFilter?,
    filterQuality: FilterQuality,
    bitmapLoader: BitmapLoader?,
    placeholder: Painter?,
    error: Painter?,
    fallback: Painter?,
    coroutineDispatcher: CoroutineDispatcher
)

Displays artwork for the given MediaMetadata.

Unit
@UnstableApi
@Composable
Artwork(
    player: Player?,
    modifier: Modifier,
    contentDescription: String?,
    alignment: Alignment,
    contentScale: ContentScale,
    alpha: Float,
    colorFilter: ColorFilter?,
    filterQuality: FilterQuality,
    bitmapLoader: BitmapLoader?,
    placeholder: Painter?,
    error: Painter?,
    fallback: Painter?,
    coroutineDispatcher: CoroutineDispatcher
)

Displays the artwork of the current MediaItem from the player.

Functions

@UnstableApi
@Composable
fun Artwork(
    player: Player?,
    modifier: Modifier = Modifier,
    contentDescription: String? = null,
    alignment: Alignment = Alignment.Center,
    contentScale: ContentScale = ContentScale.Fit,
    alpha: Float = DefaultAlpha,
    colorFilter: ColorFilter? = null,
    painter: @Composable CurrentMediaItemState.() -> Painter?
): Unit

Displays the artwork of the current MediaItem from the player.

This overload is designed for custom image loading. It delegates the rendering of the artwork to the provided painter composable function, which has access to the CurrentMediaItemState.

Parameters
player: Player?

The Player to get the current media item from.

modifier: Modifier = Modifier

The Modifier to be applied to this composable.

contentDescription: String? = null

The content description for the artwork. Defaults to title or null.

alignment: Alignment = Alignment.Center

Optional scale alignment within the container.

contentScale: ContentScale = ContentScale.Fit

Optional scale type for the artwork image.

alpha: Float = DefaultAlpha

Optional opacity to be applied to the artwork image.

colorFilter: ColorFilter? = null

Optional ColorFilter to apply for the artwork image.

painter: @Composable CurrentMediaItemState.() -> Painter?

A composable function that returns a Painter to display the artwork.

@UnstableApi
@Composable
fun Artwork(
    metadata: MediaMetadata?,
    modifier: Modifier = Modifier,
    contentDescription: String? = metadata?.title?.toString(),
    alignment: Alignment = Alignment.Center,
    contentScale: ContentScale = ContentScale.Fit,
    alpha: Float = DefaultAlpha,
    colorFilter: ColorFilter? = null,
    filterQuality: FilterQuality = DefaultFilterQuality,
    bitmapLoader: BitmapLoader? = null,
    placeholder: Painter? = null,
    error: Painter? = null,
    fallback: Painter? = error,
    coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO
): Unit

Displays artwork for the given MediaMetadata.

This overload is designed for displaying artwork from a specific MediaMetadata instance, independent of the player's current item (e.g. for displaying artwork in a playlist). If bitmapLoader is not provided, it falls back to a default implementation that only supports reading local URIs and byte arrays.

Parameters
metadata: MediaMetadata?

The MediaMetadata containing artwork info.

modifier: Modifier = Modifier

The Modifier to be applied to this composable.

contentDescription: String? = metadata?.title?.toString()

The content description for the artwork. Defaults to metadata title.

alignment: Alignment = Alignment.Center

Optional scale alignment within the container.

contentScale: ContentScale = ContentScale.Fit

Optional scale type for the artwork image.

alpha: Float = DefaultAlpha

Optional opacity to be applied to the artwork image.

colorFilter: ColorFilter? = null

Optional ColorFilter to apply for the artwork image.

filterQuality: FilterQuality = DefaultFilterQuality

Optional FilterQuality to apply to the artwork image bitmap.

bitmapLoader: BitmapLoader? = null

Optional custom artwork loader. If null, defaults to reading artwork data or URI from MediaMetadata using internal BitmapFactory.

placeholder: Painter? = null

Optional Painter to display while the artwork is loading (after the 1-second delay).

error: Painter? = null

Optional Painter to display if the artwork loading throws an exception.

fallback: Painter? = error

Optional Painter to display if the media item has no artwork. Defaults to error.

coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO

Optional CoroutineDispatcher to execute background artwork loading. Defaults to Dispatchers.IO.

@UnstableApi
@Composable
fun Artwork(
    player: Player?,
    modifier: Modifier = Modifier,
    contentDescription: String? = null,
    alignment: Alignment = Alignment.Center,
    contentScale: ContentScale = ContentScale.Fit,
    alpha: Float = DefaultAlpha,
    colorFilter: ColorFilter? = null,
    filterQuality: FilterQuality = DefaultFilterQuality,
    bitmapLoader: BitmapLoader? = null,
    placeholder: Painter? = null,
    error: Painter? = null,
    fallback: Painter? = error,
    coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO
): Unit

Displays the artwork of the current MediaItem from the player.

This overload is designed for displaying artwork using a built-in or custom BitmapLoader. It automatically tracks the player's current media item. If bitmapLoader is not provided, it falls back to a default implementation that only supports reading local URIs and byte arrays.

Parameters
player: Player?

The Player to get the current media item from.

modifier: Modifier = Modifier

The Modifier to be applied to this composable.

contentDescription: String? = null

The content description for the artwork. Defaults to title or null.

alignment: Alignment = Alignment.Center

Optional scale alignment within the container.

contentScale: ContentScale = ContentScale.Fit

Optional scale type for the artwork image.

alpha: Float = DefaultAlpha

Optional opacity to be applied to the artwork image.

colorFilter: ColorFilter? = null

Optional ColorFilter to apply for the artwork image.

filterQuality: FilterQuality = DefaultFilterQuality

Optional FilterQuality to apply to the artwork image bitmap.

bitmapLoader: BitmapLoader? = null

Optional custom artwork loader. If null, defaults to reading artwork data or URI from MediaMetadata using internal BitmapFactory.

placeholder: Painter? = null

Optional Painter to display while the artwork is loading (after the 1-second delay).

error: Painter? = null

Optional Painter to display if the artwork loading throws an exception.

fallback: Painter? = error

Optional Painter to display if the media item has no artwork. Defaults to error.

coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO

Optional CoroutineDispatcher to execute background artwork loading. Defaults to Dispatchers.IO.