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> <selectionStates>
<SelectionState runConfigName="TestApp"> <SelectionState runConfigName="TestApp">
<option name="selectionMode" value="DROPDOWN" /> <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"> <Target type="DEFAULT_BOOT">
<handle> <handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=981f7af2" /> <DeviceId pluginId="PhysicalDevice" identifier="serial=981f7af2" />

View File

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

View File

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