SimpleVideo

fun SimpleVideo(player: @Composable () -> Unit, contentDescription: String?, modifier: Modifier = Modifier, aspectRatio: SkapaAspectRatio? = SkapaAspectRatio.Ratio16by9, buttonAlignment: VideoButtonAlignment = VideoButtonAlignment.BottomTrailing, playButtonParams: VideoPlayerButtonParams.PlayButtonParams, fullScreenParams: VideoPlayerButtonParams.FullScreenParams? = null, transcriptionParams: VideoPlayerButtonParams.TranscriptionParams? = null, controlsContentPadding: PaddingValues = SimpleVideoDefaults.controlsRowPadding, onBackgroundClick: () -> Unit? = null)(source)

SimpleVideo Basic video playback with autoplay and minimal controls. Represents an open container for a video player with built-in Play/Pause, full-screen, transcription buttons and accessibility features.

Parameters

player

Composable function that represents the video player.

contentDescription

The content description for the video player, used for accessibility. This should describe the video content, not the player itself.

modifier

Modifier to be applied to the video player.

aspectRatio

The aspect ratio of the video player. This parameter is optional and can be set as null if the user needs a custom aspect ratio solution.

buttonAlignment

The alignment of the buttons in the video player. The default is VideoButtonAlignment.BottomTrailing, which places the additional buttons in the bottom trailing corner of the video player.

playButtonParams

Parameters for the play/pause button, including content description and click action.

fullScreenParams

Parameters for the full-screen button, including content description and click action.

transcriptionParams

Parameters for the transcription button, including content description and click action.

controlsContentPadding

Padding applied to the controls overlay area. This defines the total padding between the controls and the video player edges. Defaults to SimpleVideoDefaults.controlsRowPadding. Override this to adjust for system UI insets in edge-to-edge layouts or to customize the controls positioning.

onBackgroundClick

An optional lambda that is invoked when the background of the video player is pressed. This can be used for any custom action. A common pattern is to toggle the play/pause state of the video using the play buttons callback.

See also

Samples

val videoUrl = "https://www.ikea.com/pvid/0823552_fe001096.mp4"
val playState = remember { mutableStateOf(false) }
SimpleVideo(
    aspectRatio = SkapaAspectRatio.Ratio16by9,
    player = { VideoPlayer(videoUrl = videoUrl, isPlaying = playState.value) }, // Add player composable here
    contentDescription = "Video container description", // Content description for the video container
    buttonAlignment = VideoButtonAlignment.BottomTrailing,
    playButtonParams = VideoPlayerButtonParams.PlayButtonParams(
        isPlaying = playState.value,
        contentDescription = "Play / pause video",
        onClick = { playState.value = !playState.value }
    ),
    fullScreenParams = VideoPlayerButtonParams.FullScreenParams(
        contentDescription = "Full screen",
        onClick = {
            // Handle full screen click here
        }
    ),
    transcriptionParams = VideoPlayerButtonParams.TranscriptionParams(
        contentDescription = "Transcription",
        onClick = {
            // Handle transcription click here
        }
    ),
    // Optional: Handle background click for custom action if needed. This example toggles play state.
    onBackgroundClick = { playState.value = !playState.value }
)