Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
aa6bd08
wip
StaehliJ Sep 15, 2025
fa61d31
Improve PlayerSurface with a PlayerFrame
StaehliJ Sep 17, 2025
eff579d
Make easier integration
StaehliJ Sep 17, 2025
7c106c9
Replace showcase player with the PlayerFrame
StaehliJ Sep 17, 2025
4266523
Fix spherical surface
StaehliJ Sep 17, 2025
65fc7d7
Migrate all player view to the new PlayerFrame
StaehliJ Sep 17, 2025
7ed2282
Improve documentation
StaehliJ Sep 17, 2025
8befb01
Add a Scope to make easier customization of Subtitles
StaehliJ Sep 18, 2025
cc72235
Workaround when seeking during live stream
StaehliJ Sep 18, 2025
65d58df
Mark depreciated old apis
StaehliJ Sep 19, 2025
4fd522f
Update parameters order
StaehliJ Sep 19, 2025
e1610e5
Update to Media3 1.9.x
StaehliJ Nov 25, 2025
4dae8a6
Remove the API 34 workaround
StaehliJ Nov 25, 2025
5942c4f
Simplify Subtitle handling
StaehliJ Dec 1, 2025
e3053a0
Remove workaround
StaehliJ Dec 1, 2025
eb86b28
Remove no more needed method
StaehliJ Dec 1, 2025
a69708f
Disable PlayerStuckDetection during test like they do in media3 libra…
StaehliJ Dec 1, 2025
56c581f
Merge branch 'main' into use-media3-surface
StaehliJ Dec 8, 2025
2bc7053
Fix resource after updating to 1.9.0-rc01
StaehliJ Dec 8, 2025
01ba4ec
Merge branch 'main' into use-media3-surface
StaehliJ Jan 5, 2026
e4b465b
Update media3 to 1.9.0
StaehliJ Jan 5, 2026
f807c8c
Fix condition for using ImageProgressTrackerState
StaehliJ Jan 5, 2026
c1a1537
Improve image tracker state
StaehliJ Jan 5, 2026
c221b05
same parameters order
StaehliJ Jan 5, 2026
df49b89
Update doc
StaehliJ Jan 5, 2026
4e175bd
Fix doc
StaehliJ Jan 6, 2026
fe23c8f
Merge branch 'main' into use-media3-surface
StaehliJ Jan 7, 2026
995a9d2
Merge branch 'main' into use-media3-surface
StaehliJ Jan 12, 2026
c996535
Merge branch 'main' into use-media3-surface
StaehliJ Jan 16, 2026
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.12.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"
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 @@ -31,17 +31,16 @@ import kotlinx.coroutines.CoroutineScope
fun rememberProgressTrackerState(
player: PillarboxPlayer,
coroutineScope: CoroutineScope = rememberCoroutineScope(),
imageOutput: ImageOutput = ImageOutput.NO_OP,
imageOutput: ImageOutput? = null,
): ProgressTrackerState {
val context = LocalContext.current
val appSettingsRepository = remember { AppSettingsRepository(context) }
val appSettings by appSettingsRepository.getAppSettings().collectAsState(AppSettings())
val smoothSeekingEnabled = appSettings.smoothSeekingEnabled

return remember(player, smoothSeekingEnabled, imageOutput) {
when (imageOutput) {
ImageOutput.NO_OP -> ImageProgressTrackerState(player, coroutineScope, imageOutput)
else -> SimpleProgressTrackerState(player = player, coroutineScope = coroutineScope, useScrubbingMode = smoothSeekingEnabled)
}
imageOutput?.let {
ImageProgressTrackerState(player, coroutineScope, imageOutput)
} ?: SimpleProgressTrackerState(player = player, coroutineScope = coroutineScope, useScrubbingMode = smoothSeekingEnabled)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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 @@ -182,7 +182,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