Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ androidx-compose = "2025.11.01"
androidx-core = "1.17.0"
androidx-datastore = "1.2.0"
androidx-lifecycle = "2.10.0"
androidx-media3 = "1.8.0"
androidx-media3 = "1.9.0-beta01"
androidx-navigation = "2.9.6"
androidx-paging = "3.3.6"
androidx-test-core = "1.7.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.media3.test.utils.FakeClock
import androidx.test.core.app.ApplicationProvider
import ch.srgssr.pillarbox.player.PillarboxDsl
import ch.srgssr.pillarbox.player.PillarboxExoPlayer
import ch.srgssr.pillarbox.player.PlayerStuckDetectionTimeouts
import kotlin.coroutines.EmptyCoroutineContext

/**
Expand All @@ -26,6 +27,7 @@ fun PillarboxExoPlayer(context: Context = ApplicationProvider.getApplicationCont
loadControl(DefaultLoadControl())
clock(FakeClock(true))
coroutineContext(EmptyCoroutineContext)
playerStuckDetectionTimeouts(PlayerStuckDetectionTimeouts.DisabledForTest)
disableMonitoring()
block()
}.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ import ch.srgssr.pillarbox.ui.extension.isCurrentMediaItemLiveAsState
import ch.srgssr.pillarbox.ui.extension.isPlayingAsState
import ch.srgssr.pillarbox.ui.extension.playerErrorAsState
import ch.srgssr.pillarbox.ui.state.rememberCreditState
import ch.srgssr.pillarbox.ui.widget.player.PlayerSurface
import ch.srgssr.pillarbox.ui.widget.player.PlayerFrame
import coil3.compose.AsyncImage
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.map
Expand Down Expand Up @@ -183,7 +183,7 @@ fun PlayerView(
onRetry = player::prepare,
)
} else {
PlayerSurface(
PlayerFrame(
player = player,
modifier = Modifier
.fillMaxSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.ContentScale
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.media3.common.Player
Expand All @@ -47,7 +48,6 @@ import ch.srgssr.pillarbox.demo.ui.player.playlist.PlaylistView
import ch.srgssr.pillarbox.demo.ui.player.settings.PlaybackSettingsContent
import ch.srgssr.pillarbox.demo.ui.player.state.rememberFullscreenButtonState
import ch.srgssr.pillarbox.player.PillarboxPlayer
import ch.srgssr.pillarbox.ui.ScaleMode

/**
* Demo player
Expand Down Expand Up @@ -137,15 +137,15 @@ private fun PlayerContent(
val appSettings by appSettingsViewModel.currentAppSettings.collectAsStateWithLifecycle()

Column(modifier = modifier) {
var pinchScaleMode by remember(fullscreenButtonState.isInFullscreen) {
mutableStateOf(ScaleMode.Fit)
var pinchContentScale by remember(fullscreenButtonState.isInFullscreen) {
mutableStateOf(ContentScale.Fit)
}
val scalableModifier = if (fullscreenButtonState.isInFullscreen) {
Modifier.pointerInput(pinchScaleMode) {
Modifier.pointerInput(pinchContentScale) {
var lastZoomValue = 1f
detectTransformGestures(true) { _, _, zoom, _ ->
lastZoomValue *= zoom
pinchScaleMode = if (lastZoomValue < 1f) ScaleMode.Fit else ScaleMode.Crop
pinchContentScale = if (lastZoomValue < 1f) ContentScale.Fit else ContentScale.Crop
}
}
} else {
Expand All @@ -159,7 +159,7 @@ private fun PlayerContent(
player = player,
controlsToggleable = !isInPictureInPicture,
controlsVisible = !isInPictureInPicture,
scaleMode = pinchScaleMode,
contentScale = pinchContentScale,
overlayEnabled = appSettings.metricsOverlayEnabled,
overlayOptions = MetricsOverlayOptions(
textColor = appSettings.metricsOverlayTextColor.color,
Expand Down
Loading
Loading