@@ -26,8 +26,26 @@ import androidx.compose.ui.layout.ContentScale
26
26
import androidx.media3.common.Player
27
27
import androidx.media3.common.util.UnstableApi
28
28
import androidx.media3.ui.compose.modifiers.resizeWithContentScale
29
+ import androidx.media3.ui.compose.state.PresentationState
29
30
import androidx.media3.ui.compose.state.rememberPresentationState
30
31
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
+ */
31
49
@UnstableApi
32
50
@Composable
33
51
fun ContentFrame (
@@ -38,7 +56,7 @@ fun ContentFrame(
38
56
keepContentOnReset : Boolean = false,
39
57
shutter : @Composable () -> Unit = { Box (Modifier .fillMaxSize().background(Color .Black )) },
40
58
) {
41
- val presentationState = rememberPresentationState(player, keepContentOnReset)
59
+ val presentationState: PresentationState = rememberPresentationState(player, keepContentOnReset)
42
60
val scaledModifier = modifier.resizeWithContentScale(contentScale, presentationState.videoSizeDp)
43
61
44
62
// Always leave PlayerSurface to be part of the Compose tree because it will be initialised in
0 commit comments