Stay organized with collections
Save and categorize content based on your preferences.
Annotations
SurfaceType |
The type of surface used for media playbacks.
|
Constants summary
Top-level functions summary
Constants
Top-level functions
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-06-04 UTC.
[null,null,["Last updated 2025-06-04 UTC."],[],[],null,["# androidx.media3.ui.compose\n==========================\n\nAnnotations\n-----------\n\n|-------------------------------------------------------------------------|-----------------------------------------------|\n| [SurfaceType](/reference/kotlin/androidx/media3/ui/compose/SurfaceType) | The type of surface used for media playbacks. |\n\nConstants summary\n-----------------\n\n|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | `@`[UnstableApi](/reference/kotlin/androidx/media3/common/util/UnstableApi) [SURFACE_TYPE_SURFACE_VIEW](/reference/kotlin/androidx/media3/ui/compose/package-summary#SURFACE_TYPE_SURFACE_VIEW())` = 1` Surface type to create [android.view.SurfaceView](https://developer.android.com/reference/android/view/SurfaceView.html). |\n| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | `@`[UnstableApi](/reference/kotlin/androidx/media3/common/util/UnstableApi) [SURFACE_TYPE_TEXTURE_VIEW](/reference/kotlin/androidx/media3/ui/compose/package-summary#SURFACE_TYPE_TEXTURE_VIEW())` = 2` Surface type to create [android.view.TextureView](https://developer.android.com/reference/android/view/TextureView.html). |\n\nTop-level functions summary\n---------------------------\n\n|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[UnstableApi](/reference/kotlin/androidx/media3/common/util/UnstableApi) `@`[Composable](/reference/kotlin/androidx/compose/runtime/Composable) [PlayerSurface](/reference/kotlin/androidx/media3/ui/compose/package-summary#PlayerSurface(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.Int))`(` ` player: `[Player](/reference/kotlin/androidx/media3/common/Player)`?,` ` modifier: `[Modifier](/reference/kotlin/androidx/compose/ui/Modifier)`,` ` surfaceType: @`[SurfaceType](/reference/kotlin/androidx/media3/ui/compose/SurfaceType)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Provides a dedicated drawing [android.view.Surface](https://developer.android.com/reference/android/view/Surface.html) for media playbacks using a [Player](/reference/kotlin/androidx/media3/common/Player). |\n\nConstants\n---------\n\n### SURFACE_TYPE_SURFACE_VIEW\n\nArtifact: [androidx.media3:media3-ui-compose](/jetpack/androidx/releases/media3) \n[View Source](https://cs.android.com/search?q=file:androidx/media3/ui/compose/PlayerSurface.kt+symbol:SURFACE_TYPE_SURFACE_VIEW) \n\n```\n@UnstableApi\nconst val SURFACE_TYPE_SURFACE_VIEW = 1: Int\n```\n\nSurface type to create [android.view.SurfaceView](https://developer.android.com/reference/android/view/SurfaceView.html). \n\n### SURFACE_TYPE_TEXTURE_VIEW\n\nArtifact: [androidx.media3:media3-ui-compose](/jetpack/androidx/releases/media3) \n[View Source](https://cs.android.com/search?q=file:androidx/media3/ui/compose/PlayerSurface.kt+symbol:SURFACE_TYPE_TEXTURE_VIEW) \n\n```\n@UnstableApi\nconst val SURFACE_TYPE_TEXTURE_VIEW = 2: Int\n```\n\nSurface type to create [android.view.TextureView](https://developer.android.com/reference/android/view/TextureView.html).\n\nTop-level functions\n-------------------\n\n### PlayerSurface\n\nArtifact: [androidx.media3:media3-ui-compose](/jetpack/androidx/releases/media3) \n[View Source](https://cs.android.com/search?q=file:androidx/media3/ui/compose/PlayerSurface.kt+function:PlayerSurface) \n\n```\n@UnstableApi\n@Composable\nfun PlayerSurface(\n player: Player?,\n modifier: Modifier = Modifier,\n surfaceType: @SurfaceType Int = SURFACE_TYPE_SURFACE_VIEW\n): Unit\n```\n\nProvides a dedicated drawing [android.view.Surface](https://developer.android.com/reference/android/view/Surface.html) for media playbacks using a [Player](/reference/kotlin/androidx/media3/common/Player).\n\nThe player's video output is displayed with either a [android.view.SurfaceView](https://developer.android.com/reference/android/view/SurfaceView.html) or a [android.view.TextureView](https://developer.android.com/reference/android/view/TextureView.html).\n\n[Player](/reference/kotlin/androidx/media3/common/Player) takes care of attaching the rendered output to the [android.view.Surface](https://developer.android.com/reference/android/view/Surface.html) and clearing it, when it is destroyed.\n\nSee [Choosing a surface type](https://developer.android.com/media/media3/ui/playerview#surfacetype) for more information."]]