Skip to content

Commit a62a832

Browse files
authored
Merge pull request #93 from kdroidFilter/fix-Overlay-not-filling-max-Height-#83
Fix: Ensure Video Player Overlay Takes Full Height Across All Platforms
2 parents 89c2ede + 08e2daf commit a62a832

File tree

6 files changed

+32
-11
lines changed

6 files changed

+32
-11
lines changed

mediaplayer/src/androidMain/kotlin/io/github/kdroidfilter/composemediaplayer/VideoPlayerSurface.android.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ private fun VideoPlayerContent(
157157
}
158158
}
159159

160-
// Render the overlay content on top of the video
161-
overlay()
160+
// Render the overlay content on top of the video with fillMaxSize modifier
161+
// to ensure it takes the full height of the parent Box
162+
Box(modifier = Modifier.fillMaxSize()) {
163+
overlay()
164+
}
162165
}
163166
}

mediaplayer/src/iosMain/kotlin/io/github/kdroidfilter/composemediaplayer/VideoPlayerSurface.ios.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package io.github.kdroidfilter.composemediaplayer
44

55
import androidx.compose.foundation.layout.Box
6+
import androidx.compose.foundation.layout.fillMaxSize
67
import androidx.compose.runtime.Composable
78
import androidx.compose.runtime.DisposableEffect
89
import androidx.compose.runtime.remember
@@ -166,8 +167,11 @@ fun VideoPlayerSurfaceImpl(
166167
)
167168
}
168169

169-
// Render the overlay content on top of the video
170-
overlay()
170+
// Render the overlay content on top of the video with fillMaxSize modifier
171+
// to ensure it takes the full height of the parent Box
172+
Box(modifier = Modifier.fillMaxSize()) {
173+
overlay()
174+
}
171175
}
172176
}
173177

mediaplayer/src/jvmMain/kotlin/io/github/kdroidfilter/composemediaplayer/linux/LinuxVideoPlayerSurface.jvm.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.github.kdroidfilter.composemediaplayer.linux
22

33
import androidx.compose.foundation.Canvas
44
import androidx.compose.foundation.layout.Box
5+
import androidx.compose.foundation.layout.fillMaxSize
56
import androidx.compose.runtime.Composable
67
import androidx.compose.ui.Alignment
78
import androidx.compose.ui.Modifier
@@ -83,8 +84,11 @@ fun LinuxVideoPlayerSurface(
8384
)
8485
}
8586

86-
// Render the overlay content on top of the video
87-
overlay()
87+
// Render the overlay content on top of the video with fillMaxSize modifier
88+
// to ensure it takes the full height of the parent Box
89+
Box(modifier = Modifier.fillMaxSize()) {
90+
overlay()
91+
}
8892
}
8993

9094
if (playerState.isFullscreen && !isInFullscreenWindow) {

mediaplayer/src/jvmMain/kotlin/io/github/kdroidfilter/composemediaplayer/mac/MacVideoPlayerSurface.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.github.kdroidfilter.composemediaplayer.mac
22

33
import androidx.compose.foundation.Canvas
44
import androidx.compose.foundation.layout.Box
5+
import androidx.compose.foundation.layout.fillMaxSize
56
import androidx.compose.runtime.Composable
67
import androidx.compose.runtime.getValue
78
import androidx.compose.runtime.remember
@@ -78,8 +79,11 @@ fun MacVideoPlayerSurface(
7879
}
7980
}
8081

81-
// Render the overlay content on top of the video
82-
overlay()
82+
// Render the overlay content on top of the video with fillMaxSize modifier
83+
// to ensure it takes the full height of the parent Box
84+
Box(modifier = Modifier.fillMaxSize()) {
85+
overlay()
86+
}
8387
}
8488

8589
if (playerState.isFullscreen && !isInFullscreenWindow) {

mediaplayer/src/jvmMain/kotlin/io/github/kdroidfilter/composemediaplayer/windows/WindowsVideoPlayerSurface.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.github.kdroidfilter.composemediaplayer.windows
22

33
import androidx.compose.foundation.Canvas
44
import androidx.compose.foundation.layout.Box
5+
import androidx.compose.foundation.layout.fillMaxSize
56
import androidx.compose.runtime.Composable
67
import androidx.compose.runtime.LaunchedEffect
78
import androidx.compose.runtime.getValue
@@ -93,8 +94,11 @@ fun WindowsVideoPlayerSurface(
9394
}
9495
}
9596

96-
// Render the overlay content on top of the video
97-
overlay()
97+
// Render the overlay content on top of the video with fillMaxSize modifier
98+
// to ensure it takes the full height of the parent Box
99+
Box(modifier = Modifier.fillMaxSize()) {
100+
overlay()
101+
}
98102
}
99103

100104
if (playerState.isFullscreen && !isInFullscreenWindow) {

mediaplayer/src/wasmJsMain/kotlin/io/github/kdroidfilter/composemediaplayer/VideoPlayerSurface.wasmjs.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,9 @@ private fun VideoContent(
515515
.videoRatioClip(videoRatio, contentScale)
516516
) {
517517
SubtitleOverlay(playerState)
518-
overlay()
518+
Box(modifier = Modifier.fillMaxSize()) {
519+
overlay()
520+
}
519521
}
520522
}
521523

0 commit comments

Comments
 (0)