SimpleVideo
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
Composable function that represents the video player.
The content description for the video player, used for accessibility. This should describe the video content, not the player itself.
Modifier to be applied to the video player.
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.
The alignment of the buttons in the video player. The default is VideoButtonAlignment.BottomTrailing, which places the additional buttons in the bottom right corner of the video player.
Parameters for the play/pause button, including content description and click action.
Parameters for the full-screen button, including content description and click action.
Parameters for the transcription button, including content description and click action.
Optional padding applied to the controls overlay area. Use this to avoid overlap with system UI in edge-to-edge layouts. Defaults to no padding, preserving existing behavior.
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 }
)