androidx.media3.ui.compose

Annotations

SurfaceType

The type of surface view used for media playbacks.

Constants summary

const Int

Surface type equivalent to android.view.SurfaceView.

const Int

Surface type equivalent to android.view.TextureView.

Top-level functions summary

Unit
@UnstableApi
@Composable
PlayerSurface(
    player: Player,
    modifier: Modifier,
    surfaceType: @SurfaceType Int
)

Provides a dedicated drawing Surface for media playbacks using a Player.

Constants

SURFACE_TYPE_SURFACE_VIEW

@UnstableApi
const val SURFACE_TYPE_SURFACE_VIEW = 1: Int

Surface type equivalent to android.view.SurfaceView.

SURFACE_TYPE_TEXTURE_VIEW

@UnstableApi
const val SURFACE_TYPE_TEXTURE_VIEW = 2: Int

Surface type equivalent to android.view.TextureView.

Top-level functions

@UnstableApi
@Composable
fun PlayerSurface(
    player: Player,
    modifier: Modifier = Modifier,
    surfaceType: @SurfaceType Int = SURFACE_TYPE_SURFACE_VIEW
): Unit

Provides a dedicated drawing Surface for media playbacks using a Player.

The player's video output is displayed with either a android.view.SurfaceView/AndroidExternalSurface or a android.view.TextureView/AndroidEmbeddedExternalSurface.

Player takes care of attaching the rendered output to the Surface and clearing it, when it is destroyed.

See Choosing a surface type for more information.