diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f02703845..f550900a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: - name: Copy CI gradle.properties run: mkdir -p ~/.gradle; cp .github/gradle-ci.properties ~/.gradle/gradle.properties - name: Build modules - run: ./gradlew :pillarbox-demo:assembleProdDebug :pillarbox-demo-tv:assembleDebug :pillarbox-player-testutils:assembleDebug + run: ./gradlew :pillarbox-demo:assembleProdDebug :pillarbox-demo-cast:assembleDebug :pillarbox-demo-tv:assembleDebug :pillarbox-player-testutils:assembleDebug android-lint: name: Android Lint @@ -54,7 +54,7 @@ jobs: - name: Copy CI gradle.properties run: mkdir -p ~/.gradle; cp .github/gradle-ci.properties ~/.gradle/gradle.properties - name: Run Android Lint - run: ./gradlew :pillarbox-demo:lintProdDebug :pillarbox-demo-tv:lintDebug :pillarbox-player-testutils:lintDebug + run: ./gradlew :pillarbox-demo:lintProdDebug :pillarbox-demo-cast:lintDebug :pillarbox-demo-tv:lintDebug :pillarbox-player-testutils:lintDebug - uses: github/codeql-action/upload-sarif@v3 if: success() || failure() with: @@ -138,6 +138,7 @@ jobs: run: > ./gradlew :pillarbox-analytics:koverXmlReportDebug + :pillarbox-cast:koverXmlReportDebug :pillarbox-core-business:koverXmlReportDebug :pillarbox-player:koverXmlReportDebug :pillarbox-ui:koverXmlReportDebug diff --git a/build.gradle.kts b/build.gradle.kts index 4627307d6..03abd7d09 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -94,6 +94,13 @@ dependencyAnalysis { } } + project(":pillarbox-cast") { + onUnusedDependencies { + // This dependency is not used directly, but needed if we want to use the default Media3 cast receiver + exclude(libs.androidx.media3.cast) + } + } + project(":pillarbox-core-business") { onUnusedDependencies { // This dependency is not used directly, but required to be able to compile `CommandersActStreaming` @@ -107,12 +114,5 @@ dependencyAnalysis { exclude(libs.androidx.media3.dash, libs.androidx.media3.hls) } } - - project(":pillarbox-cast") { - onUnusedDependencies { - // These dependencies are not used directly, but needed if we want to use the default Media3 cast receiver. - exclude(libs.androidx.media3.cast, libs.androidx.media3.common) - } - } } } diff --git a/docs/README.md b/docs/README.md index c7d775e74..59eddabc1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -82,6 +82,9 @@ In your module's `build.gradle`/`build.gradle.kts` file, add the following depen // Player specific features implementation("ch.srgssr.pillarbox:pillarbox-player:") +// Library to handle Cast integration +implementation("ch.srgssr.pillarbox:pillarbox-cast:") + // Library to handle SRG SSR content through media URNs implementation("ch.srgssr.pillarbox:pillarbox-core-business:") @@ -125,10 +128,11 @@ dependencies { ### Integrate Pillarbox To start using Pillarbox in your project, you can check each module's documentation: -- [`pillarbox-player`](https://github.com/SRGSSR/pillarbox-android/blob/main/pillarbox-player/docs/README.md) +- [`pillarbox-analytics`](https://github.com/SRGSSR/pillarbox-android/blob/main/pillarbox-analytics/docs/README.md) +- [`pillarbox-cast`](https://github.com/SRGSSR/pillarbox-android/blob/main/pillarbox-cast/docs/README.md) - [`pillarbox-core-business`](https://github.com/SRGSSR/pillarbox-android/blob/main/pillarbox-core-business/docs/README.md) +- [`pillarbox-player`](https://github.com/SRGSSR/pillarbox-android/blob/main/pillarbox-player/docs/README.md) - [`pillarbox-ui`](https://github.com/SRGSSR/pillarbox-android/blob/main/pillarbox-ui/docs/README.md) -- [`pillarbox-analytics`](https://github.com/SRGSSR/pillarbox-android/blob/main/pillarbox-analytics/docs/README.md) ## Contributing diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 19b9bc289..beabc8537 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,6 +10,7 @@ androidx-leanback = "1.0.0" androidx-lifecycle = "2.7.0" androidx-media = "1.7.0" androidx-media3 = "1.3.1" +androidx-mediarouter = "1.3.0" androidx-navigation = "2.7.7" androidx-paging = "3.2.1" androidx-test-core = "1.5.0" @@ -29,7 +30,6 @@ kotlinx-coroutines = "1.8.0" kotlinx-kover = "0.7.6" kotlinx-serialization = "1.6.3" ktor = "2.3.10" -mediarouter = "1.3.0" mockk = "1.13.10" okhttp = "4.12.0" play-services-cast-framework = "21.3.0" @@ -55,7 +55,7 @@ androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtim androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-lifecycle" } androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" } androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" } -androidx-mediarouter = { module = "androidx.mediarouter:mediarouter", version.ref = "mediarouter" } +androidx-mediarouter = { module = "androidx.mediarouter:mediarouter", version.ref = "androidx-mediarouter" } androidx-navigation-common = { module = "androidx.navigation:navigation-common", version.ref = "androidx-navigation" } androidx-navigation-runtime = { module = "androidx.navigation:navigation-runtime", version.ref = "androidx-navigation" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidx-navigation" } @@ -99,6 +99,7 @@ kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx- kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-guava = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-guava", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } +androidx-media3-cast = { group = "androidx.media3", name = "media3-cast", version.ref = "androidx-media3" } androidx-media3-common = { group = "androidx.media3", name = "media3-common", version.ref = "androidx-media3" } androidx-media3-datasource = { group = "androidx.media3", name = "media3-datasource", version.ref = "androidx-media3" } androidx-media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "androidx-media3" } @@ -107,7 +108,6 @@ androidx-media3-ui-leanback = { group = "androidx.media3", name = "media3-ui-lea androidx-media3-dash = { group = "androidx.media3", name = "media3-exoplayer-dash", version.ref = "androidx-media3" } androidx-media3-hls = { group = "androidx.media3", name = "media3-exoplayer-hls", version.ref = "androidx-media3" } androidx-media3-session = { group = "androidx.media3", name = "media3-session", version.ref = "androidx-media3" } -androidx-media3-cast = { group = "androidx.media3", name = "media3-cast", version.ref = "androidx-media3" } androidx-media3-test-utils = { module = "androidx.media3:media3-test-utils", version.ref = "androidx-media3" } androidx-media3-test-utils-robolectric = { module = "androidx.media3:media3-test-utils-robolectric", version.ref = "androidx-media3" } androidx-media = { group = "androidx.media", name = "media", version.ref = "androidx-media" } diff --git a/pillarbox-cast/build.gradle.kts b/pillarbox-cast/build.gradle.kts index aea5505e7..2bd969d80 100644 --- a/pillarbox-cast/build.gradle.kts +++ b/pillarbox-cast/build.gradle.kts @@ -5,31 +5,13 @@ plugins { alias(libs.plugins.pillarbox.android.library.tested.module) } -android { - buildFeatures { - buildConfig = true - } - - // Mockk includes some licenses information, which may conflict with other license files. This block merges all licenses together. - // Mockk excludes all licenses instead: - // https://github.com/mockk/mockk/blob/f879502a044c83c2a5fd52992f20903209eb34f3/modules/mockk-android/build.gradle.kts#L14-L19 - packaging { - resources { - merges += "META-INF/LICENSE.md" - merges += "META-INF/LICENSE-notice.md" - } - } -} - dependencies { - // api(libs.androidx.media3.common) - api(libs.androidx.media3.cast) - implementation(platform(libs.androidx.compose.bom)) - api(libs.play.services.cast.framework) api(libs.androidx.compose.runtime) api(libs.androidx.compose.ui) + api(libs.androidx.media3.cast) implementation(libs.androidx.mediarouter) - implementation(libs.play.services.tasks) implementation(libs.guava) + api(libs.play.services.cast.framework) + implementation(libs.play.services.tasks) } diff --git a/pillarbox-cast/docs/README.md b/pillarbox-cast/docs/README.md index 3fc95ef4f..c422910a5 100644 --- a/pillarbox-cast/docs/README.md +++ b/pillarbox-cast/docs/README.md @@ -13,7 +13,7 @@ This module provides helpers to integrate cast with Pillarbox. implementation("ch.srgssr.pillarbox:pillarbox-cast:$LATEST_RELEASE_VERSION") ``` -More information can be found on the [top level README](../docs/README.md) +More information can be found on the [top level README](../../docs/README.md) ## Documentation - [Getting started](#getting-started) diff --git a/pillarbox-cast/src/main/AndroidManifest.xml b/pillarbox-cast/src/main/AndroidManifest.xml index 8bdb7e14b..8072ee00d 100644 --- a/pillarbox-cast/src/main/AndroidManifest.xml +++ b/pillarbox-cast/src/main/AndroidManifest.xml @@ -1,4 +1,2 @@ - - - + diff --git a/pillarbox-cast/src/main/java/ch/srgssr/pillarbox/cast/CastExtensions.kt b/pillarbox-cast/src/main/java/ch/srgssr/pillarbox/cast/CastExtensions.kt index b1ce158a3..42454dcae 100644 --- a/pillarbox-cast/src/main/java/ch/srgssr/pillarbox/cast/CastExtensions.kt +++ b/pillarbox-cast/src/main/java/ch/srgssr/pillarbox/cast/CastExtensions.kt @@ -9,9 +9,9 @@ import com.google.android.gms.cast.framework.CastContext import com.google.common.util.concurrent.MoreExecutors /** - * Get the SharedInstance of [CastContext]. - * Call this method inside Activity or Application. - * The more sooner, the better. + * Get the shared instance of [CastContext] if available, or initialize a new one. + * Call this method inside your [Activity][android.app.Activity] or [Application][android.app.Application]. + * The sooner, the better. */ fun Context.getCastContext(): CastContext { return CastContext.getSharedInstance() ?: CastContext.getSharedInstance(this, MoreExecutors.directExecutor()).result diff --git a/pillarbox-cast/src/main/java/ch/srgssr/pillarbox/cast/widget/CastButton.kt b/pillarbox-cast/src/main/java/ch/srgssr/pillarbox/cast/widget/CastButton.kt index 978d03adf..545a6d5d3 100644 --- a/pillarbox-cast/src/main/java/ch/srgssr/pillarbox/cast/widget/CastButton.kt +++ b/pillarbox-cast/src/main/java/ch/srgssr/pillarbox/cast/widget/CastButton.kt @@ -12,7 +12,7 @@ import com.google.android.gms.cast.framework.CastButtonFactory import com.google.android.gms.cast.framework.CastContext /** - * Make sur to instantiate a [CastContext] before using it. + * Make sure to instantiate a [CastContext] before using it. */ @Composable fun CastButton( diff --git a/pillarbox-demo-cast/build.gradle.kts b/pillarbox-demo-cast/build.gradle.kts index cefd97bc6..65b76d291 100644 --- a/pillarbox-demo-cast/build.gradle.kts +++ b/pillarbox-demo-cast/build.gradle.kts @@ -2,30 +2,24 @@ plugins { alias(libs.plugins.pillarbox.android.application) } - dependencies { - // implementation(project(":pillarbox-analytics")) - // implementation(project(":pillarbox-core-business")) implementation(project(":pillarbox-demo-shared")) - // implementation(project(":pillarbox-player")) - // implementation(project(":pillarbox-ui")) implementation(project(":pillarbox-cast")) - implementation(libs.kotlin.stdlib) - implementation(libs.androidx.core.ktx) implementation(libs.androidx.activity) - implementation(libs.androidx.fragment) - implementation(libs.play.services.cast.framework) implementation(libs.androidx.activity.compose) implementation(platform(libs.androidx.compose.bom)) - implementation(libs.androidx.compose.ui) - implementation(libs.androidx.compose.ui.graphics) - implementation(libs.androidx.compose.ui.tooling.preview) - implementation(libs.androidx.compose.material3) implementation(libs.androidx.compose.foundation) implementation(libs.androidx.compose.foundation.layout) + implementation(libs.androidx.compose.material3) implementation(libs.androidx.compose.runtime) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.graphics) implementation(libs.androidx.compose.ui.text) - implementation(libs.androidx.compose.ui.unit) - debugImplementation(libs.androidx.compose.ui.tooling) + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.compose.ui.unit) + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.fragment) + implementation(libs.kotlin.stdlib) + implementation(libs.play.services.cast.framework) } diff --git a/pillarbox-demo-cast/src/main/AndroidManifest.xml b/pillarbox-demo-cast/src/main/AndroidManifest.xml index 722269037..a1a51cfcd 100644 --- a/pillarbox-demo-cast/src/main/AndroidManifest.xml +++ b/pillarbox-demo-cast/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ - + +