fix fullscreen finally

This commit is contained in:
Christian Schabesberger 2024-07-23 17:50:52 +02:00
parent b3b7bb18ea
commit d4a7c68e5f
3 changed files with 59 additions and 58 deletions

View File

@ -4,7 +4,7 @@
<selectionStates>
<SelectionState runConfigName="TestApp">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-07-23T15:11:36.844182977Z">
<DropdownSelection timestamp="2024-07-23T15:40:12.466915691Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=981f7af2" />

View File

@ -106,14 +106,6 @@ fun VideoPlayerControllerUI(
) {
val insets = WindowInsets.systemBars
Box(
modifier = Modifier.then(
if (fullscreen)
Modifier.windowInsetsPadding(insets)
else
Modifier
)
) {
if (!uiVissible) {
TouchUi(
modifier = Modifier.fillMaxSize(),
@ -133,10 +125,12 @@ fun VideoPlayerControllerUI(
uiVissible = uiVissible,
fullscreen = fullscreen
)
Box(
modifier = if (fullscreen) {
Modifier
.background(Color.Transparent)
.windowInsetsPadding(insets)
} else {
Modifier
.background(Color.Transparent)
@ -168,7 +162,7 @@ fun VideoPlayerControllerUI(
switchToEmbeddedView
)
}
}
}
}
if (fullscreen) {

View File

@ -98,9 +98,12 @@ fun VideoPlayerUI(
// Set UI
Surface(
modifier = Modifier
modifier = Modifier.then(
if (uiState.fullscreen) Modifier.fillMaxSize()
else Modifier
.fillMaxWidth()
.aspectRatio(uiState.embeddedUiRatio), color = Color.Black
.aspectRatio(uiState.embeddedUiRatio)
), color = Color.Black
) {
Box(contentAlignment = Alignment.Center) {
PlaySurface(
@ -162,7 +165,11 @@ fun PlaySurface(
)
) {
*/
Box(modifier = Modifier.fillMaxHeight().aspectRatio(contentRatio)) {
Box(
modifier = Modifier
.fillMaxHeight()
.aspectRatio(contentRatio)
) {
AndroidView(factory = { context ->
SurfaceView(context).also { view ->
player?.setVideoSurfaceView(view)