diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38d233be3..b99eeb30d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -165,9 +165,9 @@ jobs: with: api-level: ${{ matrix.api-level }} arch: x86_64 - script: > - ./gradlew - :pillarbox-analytics:connectedDebugAndroidTest - :pillarbox-core-business:connectedDebugAndroidTest - :pillarbox-player:connectedDebugAndroidTest - :pillarbox-ui:connectedDebugAndroidTest + # Supported tasks per module + # :pillarbox-analytics:connectedDebugAndroidTest + # :pillarbox-core-business:connectedDebugAndroidTest + # :pillarbox-player:connectedDebugAndroidTest + # :pillarbox-ui:connectedDebugAndroidTest + script: ./gradlew :pillarbox-player:connectedDebugAndroidTest diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cdcae0757..6d10b72e9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ accompanist = "0.34.0" android-gradle-plugin = "8.3.0" androidx-activity = "1.8.2" androidx-annotation = "1.7.1" -androidx-compose = "2024.02.01" +androidx-compose = "2024.02.02" # https://developer.android.com/jetpack/androidx/releases/compose-kotlin androidx-compose-compiler = "1.5.10" androidx-core = "1.12.0" @@ -11,7 +11,7 @@ androidx-fragment = "1.6.2" androidx-leanback = "1.0.0" androidx-lifecycle = "2.7.0" androidx-media = "1.7.0" -androidx-media3 = "1.2.1" +androidx-media3 = "1.3.0" androidx-navigation = "2.7.7" androidx-paging = "3.2.1" androidx-test-core = "1.5.0" @@ -19,12 +19,12 @@ androidx-test-ext-junit = "1.1.5" androidx-test-monitor = "1.6.1" androidx-test-runner = "1.5.2" androidx-tv = "1.0.0-alpha10" -coil = "2.5.0" +coil = "2.6.0" comscore = "6.10.0" dependency-analysis-gradle-plugin = "1.30.0" detekt = "1.23.5" -guava = "31.1-android" -json = "20240205" +guava = "32.1.3-android" +json = "20240303" junit = "4.13.2" kotlin = "1.9.22" kotlinx-coroutines = "1.8.0" @@ -65,6 +65,7 @@ androidx-test-runner = { module = "androidx.test:runner", version.ref = "android androidx-tv-foundation = { module = "androidx.tv:tv-foundation", version.ref = "androidx-tv" } androidx-tv-material = { module = "androidx.tv:tv-material", version.ref = "androidx-tv" } coil = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" } +coil-base = { module = "io.coil-kt:coil-compose-base", version.ref = "coil" } json = { module = "org.json:json", version.ref = "json" } kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } diff --git a/pillarbox-core-business/build.gradle.kts b/pillarbox-core-business/build.gradle.kts index 2f03aad46..c306ae3ee 100644 --- a/pillarbox-core-business/build.gradle.kts +++ b/pillarbox-core-business/build.gradle.kts @@ -85,8 +85,6 @@ dependencies { implementation(libs.okhttp.logging.interceptor) api(libs.tagcommander.core) - testImplementation(project(":pillarbox-player-testutils")) - testImplementation(libs.androidx.media3.test.utils) testImplementation(libs.androidx.media3.test.utils.robolectric) testImplementation(libs.androidx.test.core) diff --git a/pillarbox-core-business/src/test/java/ch/srgssr/pillarbox/core/business/tracker/commandersact/CommandersActTrackerIntegrationTest.kt b/pillarbox-core-business/src/test/java/ch/srgssr/pillarbox/core/business/tracker/commandersact/CommandersActTrackerIntegrationTest.kt index cc7331d2c..9bcbbf099 100644 --- a/pillarbox-core-business/src/test/java/ch/srgssr/pillarbox/core/business/tracker/commandersact/CommandersActTrackerIntegrationTest.kt +++ b/pillarbox-core-business/src/test/java/ch/srgssr/pillarbox/core/business/tracker/commandersact/CommandersActTrackerIntegrationTest.kt @@ -33,7 +33,6 @@ import ch.srgssr.pillarbox.core.business.integrationlayer.service.MediaCompositi import ch.srgssr.pillarbox.core.business.tracker.DefaultMediaItemTrackerRepository import ch.srgssr.pillarbox.core.business.tracker.comscore.ComScoreTracker import ch.srgssr.pillarbox.player.data.MediaItemSource -import ch.srgssr.pillarbox.player.test.utils.TestPillarboxRunHelper import ch.srgssr.pillarbox.player.tracker.MediaItemTrackerRepository import io.mockk.Called import io.mockk.confirmVerified @@ -136,7 +135,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) player.setMediaItem(MediaItemUrn(URN_NOT_LIVE_VIDEO)) player.playWhenReady = true @@ -177,7 +176,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) verifyOrder { commandersAct.enableRunningInBackground() @@ -227,7 +226,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) verifyOrder { commandersAct.enableRunningInBackground() @@ -252,7 +251,7 @@ class CommandersActTrackerIntegrationTest { player.setPlaybackSpeed(2f) TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) verifyOrder { commandersAct.enableRunningInBackground() @@ -276,7 +275,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) clock.advanceTime(5.minutes.inWholeMilliseconds) player.setPlaybackSpeed(2f) @@ -305,7 +304,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) clock.advanceTime(2.minutes.inWholeMilliseconds) player.playWhenReady = false @@ -340,7 +339,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) clock.advanceTime(2.minutes.inWholeMilliseconds) player.playWhenReady = false @@ -386,7 +385,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) clock.advanceTime(2.minutes.inWholeMilliseconds) player.stop() @@ -420,7 +419,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) clock.advanceTime(2.minutes.inWholeMilliseconds) player.seekTo(30.seconds.inWholeMilliseconds) @@ -489,7 +488,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) clock.advanceTime(2.seconds.inWholeMilliseconds) advanceTimeBy(2.seconds) @@ -599,7 +598,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) clock.advanceTime(playTime.inWholeMilliseconds) advanceTimeBy(playTime) @@ -712,7 +711,7 @@ class CommandersActTrackerIntegrationTest { player.playWhenReady = true TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) - TestPillarboxRunHelper.runUntilStartOfMediaItem(player, 0) + TestPlayerRunHelper.playUntilStartOfMediaItem(player, 0) clock.advanceTime(playTime.inWholeMilliseconds) advanceTimeBy(playTime) diff --git a/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/data/DemoItem.kt b/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/data/DemoItem.kt index 75f7168b3..c86055f80 100644 --- a/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/data/DemoItem.kt +++ b/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/data/DemoItem.kt @@ -245,8 +245,8 @@ data class DemoItem( val OnDemandAudio = DemoItem( title = "On-demand audio stream", - description = "Il lavoro di TerraProject per una fotografia documentaria", - uri = "urn:rsi:audio:8833144" + description = "Nachrichten von 08:00 Uhr - 08.03.2024", + uri = "rn:srf:audio:b9706015-632f-4e24-9128-5de074d98eda" ) val Expired = DemoItem( diff --git a/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/data/Playlist.kt b/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/data/Playlist.kt index 7f01489be..64d395222 100644 --- a/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/data/Playlist.kt +++ b/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/data/Playlist.kt @@ -134,8 +134,8 @@ data class Playlist(val title: String, val items: List, val descriptio imageUrl = "https://ws.srf.ch/asset/image/audio/d91bbe14-55dd-458c-bc88-963462972687/EPISODE_IMAGE" ), DemoItem( - title = "Il lavoro di TerraProject per una fotografia documentaria", - uri = "urn:rsi:audio:8833144", + title = "Nachrichten von 08:00 Uhr - 08.03.2024", + uri = "urn:srf:audio:b9706015-632f-4e24-9128-5de074d98eda", description = "On-demand audio stream" ) ) diff --git a/pillarbox-demo-tv/build.gradle.kts b/pillarbox-demo-tv/build.gradle.kts index 540d0bb9d..850f793c9 100644 --- a/pillarbox-demo-tv/build.gradle.kts +++ b/pillarbox-demo-tv/build.gradle.kts @@ -103,6 +103,7 @@ dependencies { implementation(libs.androidx.tv.foundation) implementation(libs.androidx.tv.material) implementation(libs.coil) + implementation(libs.coil.base) implementation(libs.kotlin.stdlib) implementation(libs.kotlinx.coroutines.core) implementation(libs.leanback) diff --git a/pillarbox-player-testutils/src/main/java/ch/srgssr/pillarbox/player/test/utils/TestPillarboxRunHelper.kt b/pillarbox-player-testutils/src/main/java/ch/srgssr/pillarbox/player/test/utils/TestPillarboxRunHelper.kt index e74221496..9abe27e4a 100644 --- a/pillarbox-player-testutils/src/main/java/ch/srgssr/pillarbox/player/test/utils/TestPillarboxRunHelper.kt +++ b/pillarbox-player-testutils/src/main/java/ch/srgssr/pillarbox/player/test/utils/TestPillarboxRunHelper.kt @@ -9,11 +9,8 @@ import androidx.media3.common.PlaybackParameters import androidx.media3.common.Player import androidx.media3.common.util.Assertions import androidx.media3.common.util.Clock -import androidx.media3.common.util.ConditionVariable -import androidx.media3.common.util.Util import androidx.media3.exoplayer.ExoPlayer import androidx.media3.test.utils.robolectric.RobolectricUtil -import androidx.media3.test.utils.robolectric.TestPlayerRunHelper import java.util.concurrent.TimeoutException import java.util.concurrent.atomic.AtomicBoolean @@ -85,50 +82,4 @@ object TestPillarboxRunHelper { throw IllegalStateException(player.playerError) } } - - /** - * Same as [TestPlayerRunHelper.playUntilStartOfMediaItem], but doesn't pause the player afterwards. - * - * @param player The [Player]. - * @param mediaItemIndex The index of the media item. - * - * @throws TimeoutException If the [default timeout][RobolectricUtil.DEFAULT_TIMEOUT_MS] is exceeded. - * - * @see TestPlayerRunHelper.playUntilStartOfMediaItem - */ - @Throws(TimeoutException::class) - fun runUntilStartOfMediaItem(player: ExoPlayer, mediaItemIndex: Int) { - verifyMainTestThread(player) - verifyPlaybackThreadIsAlive(player) - - val applicationLooper = Util.getCurrentOrMainLooper() - val messageHandled = AtomicBoolean(false) - - player - .createMessage { _, _ -> - // Block playback thread until pause command has been sent from test thread. - val blockPlaybackThreadCondition = ConditionVariable() - - player.clock - .createHandler(applicationLooper, null) - .post { - messageHandled.set(true) - blockPlaybackThreadCondition.open() - } - - try { - player.clock.onThreadBlocked() - blockPlaybackThreadCondition.block() - } catch (e: InterruptedException) { - // Ignore. - } - } - .setPosition(mediaItemIndex, 0L) - .send() - player.play() - RobolectricUtil.runMainLooperUntil { messageHandled.get() || player.playerError != null } - if (player.playerError != null) { - throw IllegalStateException(player.playerError) - } - } } diff --git a/pillarbox-player/src/androidTest/java/ch/srgssr/pillarbox/player/utils/ContentUrls.kt b/pillarbox-player/src/androidTest/java/ch/srgssr/pillarbox/player/utils/ContentUrls.kt index c1b77df96..b730b9d44 100644 --- a/pillarbox-player/src/androidTest/java/ch/srgssr/pillarbox/player/utils/ContentUrls.kt +++ b/pillarbox-player/src/androidTest/java/ch/srgssr/pillarbox/player/utils/ContentUrls.kt @@ -12,7 +12,7 @@ object ContentUrls { const val VOD_DASH_H265 = "https://storage.googleapis.com/wvmedia/clear/hevc/tears/tears.mpd" const val LIVE_HLS = "https://rtsc3video.akamaized.net/hls/live/2042837/c3video/3/playlist.m3u8?dw=0" const val LIVE_DVR_HLS = "https://rtsc3video.akamaized.net/hls/live/2042837/c3video/3/playlist.m3u8" - const val AOD_MP3 = "https://srfaudio-a.akamaihd.net/delivery/world/6adee39a-e56e-4b22-9e38-2620ef5556ec.mp3" + const val AOD_MP3 = "https://srfaudio-a.akamaihd.net/delivery/world/af671f12-6f17-415a-9dd8-b8aee24cce8b.mp3" const val AUDIO_LIVE_MP3 = "https://stream.srg-ssr.ch/m/la-1ere/mp3_128" const val AUDIO_LIVE_DVR_HLS = "https://lsaplus.swisstxt.ch/audio/couleur3_96.stream/playlist.m3u8" } diff --git a/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTrackerState.kt b/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTrackerState.kt index d8da00b37..a4373b44a 100644 --- a/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTrackerState.kt +++ b/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTrackerState.kt @@ -4,7 +4,6 @@ */ package ch.srgssr.pillarbox.ui -import androidx.compose.runtime.Stable import androidx.media3.common.Player import kotlinx.coroutines.flow.StateFlow import kotlin.time.Duration @@ -12,7 +11,6 @@ import kotlin.time.Duration /** * Interface used to subscribe to and update the [Player] progression. */ -@Stable interface ProgressTrackerState { /** * Emits the current progress, which can be either the value being manually set, or the actual [Player] progress.