From 60e431cfb27de2585a0b25ebeb87f946157217c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaquim=20St=C3=A4hli?= Date: Mon, 30 Oct 2023 16:09:58 +0100 Subject: [PATCH] Update dependencies move extensions (#279) --- gradle/libs.versions.toml | 10 +-- .../MediaCompositionMediaItemSource.kt | 4 +- .../tracker/comscore/ComScoreTracker.kt | 2 +- .../demo/tv/player/compose/TvPlaybackRow.kt | 8 +-- .../demo/ui/player/SimplePlayerViewModel.kt | 2 +- .../ui/player/controls/PlayerPlaybackRow.kt | 15 +++-- .../MediaControllerViewModel.kt | 4 +- .../demo/ui/player/playlist/PlaylistView.kt | 7 +-- .../settings/PlayerSettingsViewModel.kt | 2 +- .../pillarbox/player/PillarboxPlayer.kt | 43 ++----------- .../pillarbox/player/PlayerCallbackFlow.kt | 3 + .../MediaItem.kt} | 2 +- .../pillarbox/player/extension/Player.kt | 61 +++++++++++++++++++ .../PlayerCommands.kt} | 2 +- .../VideoSize.kt} | 2 +- .../player/tracker/CurrentMediaItemTracker.kt | 2 +- .../pillarbox/player/TestAspectRatio.kt | 1 + .../ch/srgssr/pillarbox/ui/ProgressTracker.kt | 4 +- .../ui/extension/ComposablePlayer.kt | 4 +- 19 files changed, 104 insertions(+), 74 deletions(-) rename pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/{MediaItemExtensions.kt => extension/MediaItem.kt} (96%) create mode 100644 pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/Player.kt rename pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/{PlayerCommandsExtentions.kt => extension/PlayerCommands.kt} (97%) rename pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/{VideoSizeExtensions.kt => extension/VideoSize.kt} (95%) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 56c990536..989454618 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ accompanist = "0.33.0-alpha" activityCompose = "1.8.0" androidGradlePlugin = "8.1.2" -dataProvider = "0.5.0" +dataProvider = "0.6.2" kotlinPlugin = "1.9.10" detekt = "1.22.0" # https://github.com/detekt/detekt kotlinxSerializationJson = "1.6.0" @@ -23,12 +23,12 @@ navigationCompose = "2.7.4" pagingCompose = "3.2.1" okhttp = "4.10.0" retrofit2KotlinxSerializationConverter = "1.0.0" -tagCommanderCore = "5.4.0" -tagCommanderServerSide = "5.5.0" +tagCommanderCore = "5.4.1" +tagCommanderServerSide = "5.5.1" comscore = "6.10.0" -androidxComposeBom = "2023.10.00" +androidxComposeBom = "2023.10.01" leanback = "1.0.0" -tvCompose = "1.0.0-alpha09" +tvCompose = "1.0.0-alpha10" androidx-test-ext-junit = "1.1.5" appcompat = "1.6.1" material = "1.10.0" diff --git a/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/MediaCompositionMediaItemSource.kt b/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/MediaCompositionMediaItemSource.kt index 423402754..82e678da0 100644 --- a/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/MediaCompositionMediaItemSource.kt +++ b/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/MediaCompositionMediaItemSource.kt @@ -21,8 +21,8 @@ import ch.srgssr.pillarbox.core.business.tracker.SRGEventLoggerTracker import ch.srgssr.pillarbox.core.business.tracker.commandersact.CommandersActTracker import ch.srgssr.pillarbox.core.business.tracker.comscore.ComScoreTracker import ch.srgssr.pillarbox.player.data.MediaItemSource -import ch.srgssr.pillarbox.player.getMediaItemTrackerData -import ch.srgssr.pillarbox.player.setTrackerData +import ch.srgssr.pillarbox.player.extension.getMediaItemTrackerData +import ch.srgssr.pillarbox.player.extension.setTrackerData import io.ktor.client.plugins.ClientRequestException import kotlinx.serialization.SerializationException import java.io.IOException diff --git a/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/tracker/comscore/ComScoreTracker.kt b/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/tracker/comscore/ComScoreTracker.kt index 2e106f845..7457088bc 100644 --- a/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/tracker/comscore/ComScoreTracker.kt +++ b/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/tracker/comscore/ComScoreTracker.kt @@ -12,7 +12,7 @@ import androidx.media3.common.util.Size import androidx.media3.exoplayer.ExoPlayer import androidx.media3.exoplayer.analytics.AnalyticsListener import ch.srgssr.pillarbox.analytics.BuildConfig -import ch.srgssr.pillarbox.player.getPlaybackSpeed +import ch.srgssr.pillarbox.player.extension.getPlaybackSpeed import ch.srgssr.pillarbox.player.tracker.MediaItemTracker import ch.srgssr.pillarbox.player.utils.DebugLogger import com.comscore.streaming.ContentMetadata diff --git a/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/player/compose/TvPlaybackRow.kt b/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/player/compose/TvPlaybackRow.kt index 63659dc3c..ea424f8b6 100644 --- a/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/player/compose/TvPlaybackRow.kt +++ b/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/player/compose/TvPlaybackRow.kt @@ -24,10 +24,10 @@ import androidx.media3.common.Player import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.Icon import androidx.tv.material3.IconButton -import ch.srgssr.pillarbox.player.canSeekBack -import ch.srgssr.pillarbox.player.canSeekForward -import ch.srgssr.pillarbox.player.canSeekToNext -import ch.srgssr.pillarbox.player.canSeekToPrevious +import ch.srgssr.pillarbox.player.extension.canSeekBack +import ch.srgssr.pillarbox.player.extension.canSeekForward +import ch.srgssr.pillarbox.player.extension.canSeekToNext +import ch.srgssr.pillarbox.player.extension.canSeekToPrevious import ch.srgssr.pillarbox.ui.extension.availableCommandsAsState import ch.srgssr.pillarbox.ui.extension.isPlayingAsState import ch.srgssr.pillarbox.ui.widget.DelayedVisibilityState diff --git a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/SimplePlayerViewModel.kt b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/SimplePlayerViewModel.kt index 57caab446..45a355f4a 100644 --- a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/SimplePlayerViewModel.kt +++ b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/SimplePlayerViewModel.kt @@ -17,7 +17,7 @@ import androidx.media3.common.Timeline import androidx.media3.common.VideoSize import ch.srgssr.pillarbox.demo.shared.data.DemoItem import ch.srgssr.pillarbox.demo.shared.di.PlayerModule -import ch.srgssr.pillarbox.player.toRational +import ch.srgssr.pillarbox.player.extension.toRational import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow diff --git a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/controls/PlayerPlaybackRow.kt b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/controls/PlayerPlaybackRow.kt index acb76f501..8339ac63e 100644 --- a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/controls/PlayerPlaybackRow.kt +++ b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/controls/PlayerPlaybackRow.kt @@ -21,11 +21,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.media3.common.Player -import ch.srgssr.pillarbox.player.canPlayPause -import ch.srgssr.pillarbox.player.canSeekBack -import ch.srgssr.pillarbox.player.canSeekForward -import ch.srgssr.pillarbox.player.canSeekToNext -import ch.srgssr.pillarbox.player.canSeekToPrevious +import ch.srgssr.pillarbox.player.extension.canPlayPause +import ch.srgssr.pillarbox.player.extension.canSeekBack +import ch.srgssr.pillarbox.player.extension.canSeekForward +import ch.srgssr.pillarbox.player.extension.canSeekToNext +import ch.srgssr.pillarbox.player.extension.canSeekToPrevious import ch.srgssr.pillarbox.ui.extension.availableCommandsAsState import ch.srgssr.pillarbox.ui.extension.isPlayingAsState @@ -40,14 +40,13 @@ fun PlayerPlaybackRow( modifier: Modifier = Modifier, ) { val availableCommands = player.availableCommandsAsState() - val togglePlaybackFunction = remember(player) { + val toggleOrResumePlayback = remember(player) { { if (player.playbackState == Player.STATE_IDLE) { player.prepare() } if (player.playbackState == Player.STATE_ENDED) { player.seekToDefaultPosition() - player.play() } else { player.playWhenReady = !player.playWhenReady } @@ -71,7 +70,7 @@ fun PlayerPlaybackRow( isEnabled = availableCommands.canPlayPause(), icon = if (isPlaying) Icons.Default.Pause else Icons.Default.PlayArrow, contentDescription = if (isPlaying) "Pause" else "Play", - onClick = togglePlaybackFunction + onClick = toggleOrResumePlayback ) Button( icon = Icons.Default.FastForward, diff --git a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/mediacontroller/MediaControllerViewModel.kt b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/mediacontroller/MediaControllerViewModel.kt index 08eb49d26..f8cf036f5 100644 --- a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/mediacontroller/MediaControllerViewModel.kt +++ b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/mediacontroller/MediaControllerViewModel.kt @@ -11,8 +11,8 @@ import androidx.lifecycle.viewModelScope import androidx.media3.session.MediaBrowser import androidx.media3.session.SessionToken import ch.srgssr.pillarbox.demo.service.DemoMediaLibraryService -import ch.srgssr.pillarbox.player.RATIONAL_ONE -import ch.srgssr.pillarbox.player.toRational +import ch.srgssr.pillarbox.player.extension.RATIONAL_ONE +import ch.srgssr.pillarbox.player.extension.toRational import ch.srgssr.pillarbox.player.videoSizeAsFlow import com.google.common.util.concurrent.MoreExecutors import kotlinx.coroutines.ExperimentalCoroutinesApi diff --git a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/playlist/PlaylistView.kt b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/playlist/PlaylistView.kt index 5dd8d3cc2..0a61eabd4 100644 --- a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/playlist/PlaylistView.kt +++ b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/playlist/PlaylistView.kt @@ -34,7 +34,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.media3.common.C import androidx.media3.common.MediaItem import androidx.media3.common.MediaMetadata import androidx.media3.common.Player @@ -80,11 +79,11 @@ fun PlaylistView( onRemoveItemIndex = player::removeMediaItem, onMoveItemIndex = player::moveMediaItem, onItemClick = { _: MediaItem, index: Int -> - player.seekTo(index, C.TIME_UNSET) - if (player.playbackState == Player.STATE_IDLE || player.playerError != null) { + player.seekToDefaultPosition(index) + player.play() + if (player.playbackState == Player.STATE_IDLE) { player.prepare() } - player.play() }, onAddToPlaylistClick = { addItemDialogState.value = true diff --git a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/settings/PlayerSettingsViewModel.kt b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/settings/PlayerSettingsViewModel.kt index 272707999..6319cd662 100644 --- a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/settings/PlayerSettingsViewModel.kt +++ b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/player/settings/PlayerSettingsViewModel.kt @@ -9,9 +9,9 @@ import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.viewModelScope import androidx.media3.common.Player import ch.srgssr.pillarbox.player.extension.audio +import ch.srgssr.pillarbox.player.extension.getPlaybackSpeed import ch.srgssr.pillarbox.player.extension.text import ch.srgssr.pillarbox.player.getCurrentTracksAsFlow -import ch.srgssr.pillarbox.player.getPlaybackSpeed import ch.srgssr.pillarbox.player.getPlaybackSpeedAsFlow import ch.srgssr.pillarbox.player.getTrackSelectionParametersAsFlow import kotlinx.coroutines.flow.SharingStarted diff --git a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PillarboxPlayer.kt b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PillarboxPlayer.kt index 6e4da4f53..81bdc9c43 100644 --- a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PillarboxPlayer.kt +++ b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PillarboxPlayer.kt @@ -5,7 +5,6 @@ package ch.srgssr.pillarbox.player import android.content.Context -import androidx.media3.common.MediaItem import androidx.media3.common.PlaybackException import androidx.media3.common.PlaybackParameters import androidx.media3.common.Player @@ -22,6 +21,7 @@ import androidx.media3.exoplayer.trackselection.DefaultTrackSelector import androidx.media3.exoplayer.upstream.DefaultBandwidthMeter import androidx.media3.exoplayer.util.EventLogger import ch.srgssr.pillarbox.player.data.MediaItemSource +import ch.srgssr.pillarbox.player.extension.getPlaybackSpeed import ch.srgssr.pillarbox.player.extension.setPreferredAudioRoleFlagsToAccessibilityManagerSettings import ch.srgssr.pillarbox.player.extension.setSeekIncrements import ch.srgssr.pillarbox.player.source.PillarboxMediaSourceFactory @@ -162,39 +162,6 @@ class PillarboxPlayer internal constructor( } } -/** - * Get a snapshot of the current media items - */ -fun Player.getCurrentMediaItems(): List { - if (mediaItemCount == 0) { - return emptyList() - } - val count = mediaItemCount - return ArrayList(count).apply { - for (i in 0 until count) { - add(getMediaItemAt(i)) - } - } -} - -/** - * Get playback speed - * - * @return [Player.getPlaybackParameters] speed - */ -fun Player.getPlaybackSpeed(): Float { - return playbackParameters.speed -} - -/** - * Current position percent - * - * @return the current position in percent [0,1]. - */ -fun Player.currentPositionPercentage(): Float { - return currentPosition / duration.coerceAtLeast(1).toFloat() -} - /** * Return if the playback [speed] is possible at [position]. * Always return true for none live content or if [Player.getCurrentTimeline] is empty. @@ -212,10 +179,6 @@ fun Player.isPlaybackSpeedPossibleAtPosition(position: Long, speed: Float, windo return window.isPlaybackSpeedPossibleAtPosition(position, speed) } -internal fun Window.isAtDefaultPosition(positionMs: Long): Boolean { - return positionMs >= defaultPositionMs -} - internal fun Window.isPlaybackSpeedPossibleAtPosition(positionMs: Long, playbackSpeed: Float): Boolean { return when { !isLive() || playbackSpeed == NormalSpeed -> true @@ -225,4 +188,8 @@ internal fun Window.isPlaybackSpeedPossibleAtPosition(positionMs: Long, playback } } +internal fun Window.isAtDefaultPosition(positionMs: Long): Boolean { + return positionMs >= defaultPositionMs +} + private const val NormalSpeed = 1.0f diff --git a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PlayerCallbackFlow.kt b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PlayerCallbackFlow.kt index d0126cc8f..d0828bc47 100644 --- a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PlayerCallbackFlow.kt +++ b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PlayerCallbackFlow.kt @@ -14,6 +14,9 @@ import androidx.media3.common.Timeline import androidx.media3.common.TrackSelectionParameters import androidx.media3.common.Tracks import androidx.media3.common.VideoSize +import ch.srgssr.pillarbox.player.extension.computeAspectRatio +import ch.srgssr.pillarbox.player.extension.getCurrentMediaItems +import ch.srgssr.pillarbox.player.extension.getPlaybackSpeed import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.ProducerScope import kotlinx.coroutines.channels.awaitClose diff --git a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/MediaItemExtensions.kt b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/MediaItem.kt similarity index 96% rename from pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/MediaItemExtensions.kt rename to pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/MediaItem.kt index ef388e4f5..b8b9d7bd5 100644 --- a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/MediaItemExtensions.kt +++ b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/MediaItem.kt @@ -2,7 +2,7 @@ * Copyright (c) 2023. SRG SSR. All rights reserved. * License information is available from the LICENSE file. */ -package ch.srgssr.pillarbox.player +package ch.srgssr.pillarbox.player.extension import androidx.media3.common.MediaItem import ch.srgssr.pillarbox.player.tracker.MediaItemTrackerData diff --git a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/Player.kt b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/Player.kt new file mode 100644 index 000000000..8ba93bcc1 --- /dev/null +++ b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/Player.kt @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2023. SRG SSR. All rights reserved. + * License information is available from the LICENSE file. + */ +package ch.srgssr.pillarbox.player.extension + +import androidx.media3.common.MediaItem +import androidx.media3.common.Player + +/** + * Resume playback + */ +fun Player.startPlayback() { + when (playbackState) { + Player.STATE_IDLE -> { + prepare() + } + + Player.STATE_ENDED -> { + seekToDefaultPosition() + } + + else -> { + // Nothing + } + } + play() +} + +/** + * Get a snapshot of the current media items + */ +fun Player.getCurrentMediaItems(): List { + if (mediaItemCount == 0) { + return emptyList() + } + val count = mediaItemCount + return ArrayList(count).apply { + for (i in 0 until count) { + add(getMediaItemAt(i)) + } + } +} + +/** + * Get playback speed + * + * @return [Player.getPlaybackParameters] speed + */ +fun Player.getPlaybackSpeed(): Float { + return playbackParameters.speed +} + +/** + * Current position percent + * + * @return the current position in percent [0,1]. + */ +fun Player.currentPositionPercentage(): Float { + return currentPosition / duration.coerceAtLeast(1).toFloat() +} diff --git a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PlayerCommandsExtentions.kt b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/PlayerCommands.kt similarity index 97% rename from pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PlayerCommandsExtentions.kt rename to pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/PlayerCommands.kt index 1fad8ddcb..c6ef99202 100644 --- a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/PlayerCommandsExtentions.kt +++ b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/PlayerCommands.kt @@ -4,7 +4,7 @@ */ @file:Suppress("unused") -package ch.srgssr.pillarbox.player +package ch.srgssr.pillarbox.player.extension import androidx.media3.common.Player diff --git a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/VideoSizeExtensions.kt b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/VideoSize.kt similarity index 95% rename from pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/VideoSizeExtensions.kt rename to pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/VideoSize.kt index 30d491491..043effa1c 100644 --- a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/VideoSizeExtensions.kt +++ b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/extension/VideoSize.kt @@ -2,7 +2,7 @@ * Copyright (c) 2023. SRG SSR. All rights reserved. * License information is available from the LICENSE file. */ -package ch.srgssr.pillarbox.player +package ch.srgssr.pillarbox.player.extension import android.util.Rational import androidx.media3.common.VideoSize diff --git a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/tracker/CurrentMediaItemTracker.kt b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/tracker/CurrentMediaItemTracker.kt index 3c2169de3..3af46db99 100644 --- a/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/tracker/CurrentMediaItemTracker.kt +++ b/pillarbox-player/src/main/java/ch/srgssr/pillarbox/player/tracker/CurrentMediaItemTracker.kt @@ -11,7 +11,7 @@ import androidx.media3.common.Timeline.Window import androidx.media3.exoplayer.ExoPlayer import androidx.media3.exoplayer.analytics.AnalyticsListener import androidx.media3.exoplayer.analytics.AnalyticsListener.EventTime -import ch.srgssr.pillarbox.player.getMediaItemTrackerDataOrNull +import ch.srgssr.pillarbox.player.extension.getMediaItemTrackerDataOrNull import ch.srgssr.pillarbox.player.utils.DebugLogger import ch.srgssr.pillarbox.player.utils.StringUtil diff --git a/pillarbox-player/src/test/java/ch/srgssr/pillarbox/player/TestAspectRatio.kt b/pillarbox-player/src/test/java/ch/srgssr/pillarbox/player/TestAspectRatio.kt index f1b328a81..3fc4ec7f1 100644 --- a/pillarbox-player/src/test/java/ch/srgssr/pillarbox/player/TestAspectRatio.kt +++ b/pillarbox-player/src/test/java/ch/srgssr/pillarbox/player/TestAspectRatio.kt @@ -5,6 +5,7 @@ package ch.srgssr.pillarbox.player import androidx.media3.common.VideoSize +import ch.srgssr.pillarbox.player.extension.computeAspectRatio import org.junit.Assert import org.junit.Test diff --git a/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTracker.kt b/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTracker.kt index 508c9caff..5e9f163c8 100644 --- a/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTracker.kt +++ b/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTracker.kt @@ -12,9 +12,9 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember import androidx.media3.common.Player import ch.srgssr.pillarbox.player.availableCommandsAsFlow -import ch.srgssr.pillarbox.player.canSeek import ch.srgssr.pillarbox.player.currentPositionAsFlow -import ch.srgssr.pillarbox.player.currentPositionPercentage +import ch.srgssr.pillarbox.player.extension.canSeek +import ch.srgssr.pillarbox.player.extension.currentPositionPercentage import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.collectLatest diff --git a/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/extension/ComposablePlayer.kt b/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/extension/ComposablePlayer.kt index 227d6424b..7695700af 100644 --- a/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/extension/ComposablePlayer.kt +++ b/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/extension/ComposablePlayer.kt @@ -17,11 +17,11 @@ import ch.srgssr.pillarbox.player.availableCommandsAsFlow import ch.srgssr.pillarbox.player.currentMediaMetadataAsFlow import ch.srgssr.pillarbox.player.currentPositionAsFlow import ch.srgssr.pillarbox.player.durationAsFlow +import ch.srgssr.pillarbox.player.extension.getCurrentMediaItems +import ch.srgssr.pillarbox.player.extension.getPlaybackSpeed import ch.srgssr.pillarbox.player.getAspectRatioAsFlow import ch.srgssr.pillarbox.player.getCurrentMediaItemIndexAsFlow -import ch.srgssr.pillarbox.player.getCurrentMediaItems import ch.srgssr.pillarbox.player.getCurrentMediaItemsAsFlow -import ch.srgssr.pillarbox.player.getPlaybackSpeed import ch.srgssr.pillarbox.player.getPlaybackSpeedAsFlow import ch.srgssr.pillarbox.player.isPlayingAsFlow import ch.srgssr.pillarbox.player.mediaItemCountAsFlow