Skip to content

Commit 55049e2

Browse files
oceanjulescopybara-github
authored andcommitted
[ui-compose] Add KDoc to ContentFrame
PiperOrigin-RevId: 795475865
1 parent 461829d commit 55049e2

File tree

1 file changed

+19
-1
lines changed
  • libraries/ui_compose/src/main/java/androidx/media3/ui/compose

1 file changed

+19
-1
lines changed

libraries/ui_compose/src/main/java/androidx/media3/ui/compose/ContentFrame.kt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,26 @@ import androidx.compose.ui.layout.ContentScale
2626
import androidx.media3.common.Player
2727
import androidx.media3.common.util.UnstableApi
2828
import androidx.media3.ui.compose.modifiers.resizeWithContentScale
29+
import androidx.media3.ui.compose.state.PresentationState
2930
import androidx.media3.ui.compose.state.rememberPresentationState
3031

32+
/**
33+
* A container for displaying media content from a [Player].
34+
*
35+
* This composable handles the underlying [PlayerSurface] for video playback, resizing the video
36+
* based on the provided [ContentScale], and displaying a [shutter] according to the
37+
* [PresentationState] based off the [Player].
38+
*
39+
* @param player The attached [Player] that provides media to this content frame.
40+
* @param modifier The [Modifier] to be applied to the layout.
41+
* @param surfaceType The type of surface to use for video playback. Can be either
42+
* [SURFACE_TYPE_SURFACE_VIEW] or [SURFACE_TYPE_TEXTURE_VIEW].
43+
* @param contentScale The [ContentScale] strategy for the container.
44+
* @param keepContentOnReset If `true`, the last rendered frame will remain visible when the player
45+
* is reset. If `false`, the surface will be cleared.
46+
* @param shutter A composable that is displayed when the video surface needs to be covered. By
47+
* default, this is a black background.
48+
*/
3149
@UnstableApi
3250
@Composable
3351
fun ContentFrame(
@@ -38,7 +56,7 @@ fun ContentFrame(
3856
keepContentOnReset: Boolean = false,
3957
shutter: @Composable () -> Unit = { Box(Modifier.fillMaxSize().background(Color.Black)) },
4058
) {
41-
val presentationState = rememberPresentationState(player, keepContentOnReset)
59+
val presentationState: PresentationState = rememberPresentationState(player, keepContentOnReset)
4260
val scaledModifier = modifier.resizeWithContentScale(contentScale, presentationState.videoSizeDp)
4361

4462
// Always leave PlayerSurface to be part of the Compose tree because it will be initialised in

0 commit comments

Comments
 (0)