From ac0a145a1af98f293370486828cb8a0dd635dd77 Mon Sep 17 00:00:00 2001 From: Silas Della Contrada Date: Fri, 10 Jan 2025 14:13:41 +0100 Subject: [PATCH] feat: add paint parameter to video surface --- .../dev/silenium/multimedia/compose/player/VideoSurface.kt | 3 +++ .../multimedia/compose/player/VideoSurfaceWithControls.kt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/main/kotlin/dev/silenium/multimedia/compose/player/VideoSurface.kt b/src/main/kotlin/dev/silenium/multimedia/compose/player/VideoSurface.kt index a7aa858..6f3c183 100644 --- a/src/main/kotlin/dev/silenium/multimedia/compose/player/VideoSurface.kt +++ b/src/main/kotlin/dev/silenium/multimedia/compose/player/VideoSurface.kt @@ -11,6 +11,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import dev.silenium.compose.gl.surface.* import dev.silenium.multimedia.core.annotation.InternalMultimediaApi +import org.jetbrains.skia.Paint @Composable private fun createGLSurface( @@ -52,12 +53,14 @@ fun VideoSurface( player: VideoPlayer, showStats: Boolean = false, modifier: Modifier = Modifier, + paint: Paint = Paint(), ) { val surfaceState = rememberGLSurfaceState() BoxWithConstraints(modifier = modifier) { GLSurfaceView( surface = player.surface!!, modifier = Modifier.matchParentSize(), + paint = paint, ) if (showStats) { Surface( diff --git a/src/main/kotlin/dev/silenium/multimedia/compose/player/VideoSurfaceWithControls.kt b/src/main/kotlin/dev/silenium/multimedia/compose/player/VideoSurfaceWithControls.kt index a637e59..f237708 100644 --- a/src/main/kotlin/dev/silenium/multimedia/compose/player/VideoSurfaceWithControls.kt +++ b/src/main/kotlin/dev/silenium/multimedia/compose/player/VideoSurfaceWithControls.kt @@ -6,6 +6,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester +import org.jetbrains.skia.Paint @Composable fun VideoSurfaceWithControls( @@ -13,6 +14,7 @@ fun VideoSurfaceWithControls( modifier: Modifier = Modifier, showStats: Boolean = false, controlFocusRequester: FocusRequester? = null, + paint: Paint = Paint(), ) { BoxWithConstraints(modifier) { VideoSurface( @@ -23,6 +25,7 @@ fun VideoSurfaceWithControls( maxWidth = maxWidth, maxHeight = maxHeight, ), + paint = paint, ) VideoSurfaceControls(player, Modifier.matchParentSize(), controlFocusRequester) }