androidx.media3.ui.compose.material3

Top-level functions summary

Unit
@UnstableApi
@Composable
Player(
    player: Player?,
    modifier: Modifier,
    surfaceType: @SurfaceType Int,
    contentScale: ContentScale,
    keepContentOnReset: Boolean,
    shutter: @Composable () -> Unit,
    controlsTimeoutMs: Long,
    topControls: (@Composable BoxScope.(Player?, Boolean) -> Unit)?,
    centerControls: (@Composable BoxScope.(Player?, Boolean) -> Unit)?,
    bottomControls: (@Composable BoxScope.(Player?, Boolean) -> Unit)?
)

A composable that provides a basic player UI layout, combining a ContentFrame for displaying player content with customizable controls and a shutter.

Top-level functions

@UnstableApi
@Composable
fun Player(
    player: Player?,
    modifier: Modifier = Modifier,
    surfaceType: @SurfaceType Int = SURFACE_TYPE_SURFACE_VIEW,
    contentScale: ContentScale = ContentScale.Fit,
    keepContentOnReset: Boolean = false,
    shutter: @Composable () -> Unit = { PlayerDefaults.Shutter() },
    controlsTimeoutMs: Long = 3000,
    topControls: (@Composable BoxScope.(Player?, Boolean) -> Unit)? = defaultTopControls,
    centerControls: (@Composable BoxScope.(Player?, Boolean) -> Unit)? = defaultCenterControls,
    bottomControls: (@Composable BoxScope.(Player?, Boolean) -> Unit)? = defaultBottomControls
): Unit

A composable that provides a basic player UI layout, combining a ContentFrame for displaying player content with customizable controls and a shutter.

This composable is designed to be a flexible container for building player interfaces. It consists of a ContentFrame that handles the rendering of the player's video, overlaid with optional controls and a shutter.

Parameters
player: Player?

The Player instance to be controlled and whose content is displayed.

modifier: Modifier = Modifier

The Modifier to be applied to the outer Box.

surfaceType: @SurfaceType Int = SURFACE_TYPE_SURFACE_VIEW

The type of surface to use for video rendering. See SurfaceType.

contentScale: ContentScale = ContentScale.Fit

The scaling mode to apply to the content within the ContentFrame.

keepContentOnReset: Boolean = false

Whether to keep the content visible when the player is reset.

shutter: @Composable () -> Unit = { PlayerDefaults.Shutter() }

A composable to be displayed as a shutter over the content. The default shutter is a black Box.

controlsTimeoutMs: Long = 3000

Delay amount in milliseconds for keeping the controls visible on every interaction with the screen. A non-positive value will cause the controls to remain visible indefinitely, unless visibility is toggled by clicking on the component.

topControls: (@Composable BoxScope.(Player?, Boolean) -> Unit)? = defaultTopControls

A composable aligned with Alignment.TopCenter, receiving the player.

centerControls: (@Composable BoxScope.(Player?, Boolean) -> Unit)? = defaultCenterControls

A composable aligned with Alignment.Center, receiving the player.

bottomControls: (@Composable BoxScope.(Player?, Boolean) -> Unit)? = defaultBottomControls

A composable aligned with Alignment.BottomCenter, receiving the player.