diff --git a/app/build.gradle b/app/build.gradle index 7df46261..4405f29e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,12 +23,32 @@ android { flavorDimensions = ["media3"] productFlavors { At_latest { dimension "media3" } - // This module does not currently need different src sets for different media3 versions. - // We still need to declare different flavors so we can create version-specific variants at_1_0 { dimension "media3" } at_1_1 { dimension "media3" } at_1_2 { dimension "media3" } at_1_3 { dimension "media3" } + at_1_4 { dimension "media3" } + } + + sourceSets { + At_latest { + java.srcDirs += "src/compatFrom1_3/java" + } + at_1_0 { + java.srcDirs += "src/compatFrom1_0/java" + } + at_1_1 { + java.srcDirs += "src/compatFrom1_0/java" + } + at_1_2 { + java.srcDirs += "src/compatFrom1_0/java" + } + at_1_3 { + java.srcDirs += "src/compatFrom1_3/java" + } + at_1_4 { + java.srcDirs += "src/compatFrom1_3/java" + } } buildTypes { @@ -87,37 +107,66 @@ dependencies { //noinspection GradleDependency at_1_0Implementation "androidx.media3:media3-exoplayer-rtsp:1.0.0" + //noinspection GradleDependency at_1_1Implementation "androidx.media3:media3-exoplayer:1.1.1" + //noinspection GradleDependency at_1_1Implementation "androidx.media3:media3-session:1.1.1" + //noinspection GradleDependency at_1_1Implementation "androidx.media3:media3-ui:1.1.1" + //noinspection GradleDependency at_1_1Implementation "androidx.media3:media3-exoplayer-ima:1.1.1" + //noinspection GradleDependency at_1_1Implementation "androidx.media3:media3-exoplayer-dash:1.1.1" + //noinspection GradleDependency at_1_1Implementation "androidx.media3:media3-exoplayer-hls:1.1.1" + //noinspection GradleDependency at_1_1Implementation "androidx.media3:media3-exoplayer-rtsp:1.1.1" + //noinspection GradleDependency at_1_2Implementation "androidx.media3:media3-exoplayer:1.2.0" + //noinspection GradleDependency at_1_2Implementation "androidx.media3:media3-session:1.2.0" + //noinspection GradleDependency at_1_2Implementation "androidx.media3:media3-ui:1.2.0" + //noinspection GradleDependency at_1_2Implementation "androidx.media3:media3-exoplayer-ima:1.2.0" + //noinspection GradleDependency at_1_2Implementation "androidx.media3:media3-exoplayer-dash:1.2.0" + //noinspection GradleDependency at_1_2Implementation "androidx.media3:media3-exoplayer-hls:1.2.0" + //noinspection GradleDependency at_1_2Implementation "androidx.media3:media3-exoplayer-rtsp:1.2.0" - + + //noinspection GradleDependency at_1_3Implementation "androidx.media3:media3-exoplayer:1.3.0" + //noinspection GradleDependency at_1_3Implementation "androidx.media3:media3-session:1.3.0" + //noinspection GradleDependency at_1_3Implementation "androidx.media3:media3-ui:1.3.0" + //noinspection GradleDependency at_1_3Implementation "androidx.media3:media3-exoplayer-ima:1.3.0" + //noinspection GradleDependency at_1_3Implementation "androidx.media3:media3-exoplayer-dash:1.3.0" + //noinspection GradleDependency at_1_3Implementation "androidx.media3:media3-exoplayer-hls:1.3.0" + //noinspection GradleDependency at_1_3Implementation "androidx.media3:media3-exoplayer-rtsp:1.3.0" - At_latestImplementation "androidx.media3:media3-exoplayer:1.3.1" - At_latestImplementation "androidx.media3:media3-session:1.3.1" - At_latestImplementation "androidx.media3:media3-ui:1.3.1" - At_latestImplementation "androidx.media3:media3-exoplayer-ima:1.3.1" - At_latestImplementation "androidx.media3:media3-exoplayer-dash:1.3.1" - At_latestImplementation "androidx.media3:media3-exoplayer-hls:1.3.1" - At_latestImplementation "androidx.media3:media3-exoplayer-rtsp:1.3.1" + at_1_4Implementation "androidx.media3:media3-exoplayer:1.4.1" + at_1_4Implementation "androidx.media3:media3-session:1.4.1" + at_1_4Implementation "androidx.media3:media3-ui:1.4.1" + at_1_4Implementation "androidx.media3:media3-exoplayer-ima:1.4.1" + at_1_4Implementation "androidx.media3:media3-exoplayer-dash:1.4.1" + at_1_4Implementation "androidx.media3:media3-exoplayer-hls:1.4.1" + at_1_4Implementation "androidx.media3:media3-exoplayer-rtsp:1.4.1" + + At_latestImplementation "androidx.media3:media3-exoplayer:1.4.1" + At_latestImplementation "androidx.media3:media3-session:1.4.1" + At_latestImplementation "androidx.media3:media3-ui:1.4.1" + At_latestImplementation "androidx.media3:media3-exoplayer-ima:1.4.1" + At_latestImplementation "androidx.media3:media3-exoplayer-dash:1.4.1" + At_latestImplementation "androidx.media3:media3-exoplayer-hls:1.4.1" + At_latestImplementation "androidx.media3:media3-exoplayer-rtsp:1.4.1" implementation 'androidx.core:core-ktx:1.12.0' implementation 'androidx.appcompat:appcompat:1.6.1' diff --git a/app/src/compatFrom1_0/java/VersionCompat.kt b/app/src/compatFrom1_0/java/VersionCompat.kt new file mode 100644 index 00000000..949fe5b1 --- /dev/null +++ b/app/src/compatFrom1_0/java/VersionCompat.kt @@ -0,0 +1,16 @@ +import android.os.Bundle +import androidx.media3.common.util.UnstableApi +import androidx.media3.exoplayer.ima.ImaServerSideAdInsertionMediaSource + +/* + * VersionCompat.kt: Functions with different Variants for different media3 + * versions. There are other version of this file for other variants. Look + * in the source set defs for more details + */ + +object VersionCompat { + @androidx.annotation.OptIn(UnstableApi::class) + fun adsLoaderStateFromBundle(bundle: Bundle): ImaServerSideAdInsertionMediaSource.AdsLoader.State { + return ImaServerSideAdInsertionMediaSource.AdsLoader.State.CREATOR.fromBundle(bundle) + } +} diff --git a/app/src/compatFrom1_3/java/VersionCompat.kt b/app/src/compatFrom1_3/java/VersionCompat.kt new file mode 100644 index 00000000..3ea848f0 --- /dev/null +++ b/app/src/compatFrom1_3/java/VersionCompat.kt @@ -0,0 +1,17 @@ +import android.os.Bundle +import androidx.media3.common.util.UnstableApi +import androidx.media3.exoplayer.ima.ImaServerSideAdInsertionMediaSource + +/** + * Functions with different Variants for different media3 versions. There are other version of this + * file for other variants. See the sourceSet defs for more details + * + * Customers probably don't need a class like this. We have one because we support older versions of + * media3, so we need variants + */ +object VersionCompat { + @androidx.annotation.OptIn(UnstableApi::class) + fun adsLoaderStateFromBundle(bundle: Bundle): ImaServerSideAdInsertionMediaSource.AdsLoader.State { + return ImaServerSideAdInsertionMediaSource.AdsLoader.State.fromBundle(bundle) + } +} diff --git a/app/src/main/java/com/mux/stats/muxdatasdkformedia3/examples/ima/ImaServerAdsActivity.kt b/app/src/main/java/com/mux/stats/muxdatasdkformedia3/examples/ima/ImaServerAdsActivity.kt index 82534215..c55806ed 100644 --- a/app/src/main/java/com/mux/stats/muxdatasdkformedia3/examples/ima/ImaServerAdsActivity.kt +++ b/app/src/main/java/com/mux/stats/muxdatasdkformedia3/examples/ima/ImaServerAdsActivity.kt @@ -1,5 +1,6 @@ package com.mux.stats.muxdatasdkformedia3.examples.ima +import VersionCompat import android.net.Uri import android.os.Bundle import android.os.PersistableBundle @@ -60,7 +61,7 @@ class ImaServerAdsActivity : AppCompatActivity() { window.addFlags(View.KEEP_SCREEN_ON) adsLoaderState = savedInstanceState?.getBundle(EXTRA_ADS_LOADER_STATE) - ?.let { AdsLoader.State.CREATOR.fromBundle(it) } + ?.let { VersionCompat.adsLoaderStateFromBundle(it) } } override fun onResume() { diff --git a/build.gradle b/build.gradle index 655c1792..1077c758 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id 'com.android.application' version '8.5.2' apply false id 'com.android.library' version '8.5.2' apply false id 'org.jetbrains.kotlin.android' version '1.9.24' apply false - id 'com.mux.gradle.android.mux-android-distribution' version '1.2.1' apply false + id 'com.mux.gradle.android.mux-android-distribution' version '1.3.0' apply false id "org.jetbrains.dokka" version "1.6.10" } diff --git a/library-exo/build.gradle b/library-exo/build.gradle index 3283a823..7b876ffa 100644 --- a/library-exo/build.gradle +++ b/library-exo/build.gradle @@ -32,6 +32,7 @@ android { at_1_1 { dimension "media3" } at_1_2 { dimension "media3" } at_1_3 { dimension "media3" } + at_1_4 { dimension "media3" } } buildTypes { @@ -64,7 +65,7 @@ muxDistribution { publicReleaseIf releaseIfCmdFlag("publicRelease") // TODO: This is kinda clumsy, packageJavadocs should be a function not a property probably - packageJavadocs = releaseOnTag().call() + packageJavadocs = releaseIfCmdFlag("publicRelease").call() publishIf { it.containsIgnoreCase("release") } artifactoryConfig { contextUrl = "https://muxinc.jfrog.io/artifactory/" @@ -123,9 +124,14 @@ dependencies { at_1_3CompileOnly "androidx.media3:media3-exoplayer-hls:1.3.0" //noinspection GradleDependency - At_latestApi "androidx.media3:media3-exoplayer:1.3.0" + at_1_4Api "androidx.media3:media3-exoplayer:1.4.0" //noinspection GradleDependency - At_latestCompileOnly "androidx.media3:media3-exoplayer-hls:1.3.0" + at_1_4CompileOnly "androidx.media3:media3-exoplayer-hls:1.4.0" + + //noinspection GradleDependency + At_latestApi "androidx.media3:media3-exoplayer:1.4.0" + //noinspection GradleDependency + At_latestCompileOnly "androidx.media3:media3-exoplayer-hls:1.4.0" testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' diff --git a/library-ima/build.gradle b/library-ima/build.gradle index 3789154f..f8561b48 100644 --- a/library-ima/build.gradle +++ b/library-ima/build.gradle @@ -32,6 +32,7 @@ android { at_1_1 { dimension "media3" } at_1_2 { dimension "media3" } at_1_3 { dimension "media3" } + at_1_4 { dimension "media3" } } buildTypes { @@ -64,7 +65,7 @@ muxDistribution { publicReleaseIf releaseIfCmdFlag("publicRelease") // TODO: This is kinda clumsy, packageJavadocs should be a function not a property probably - packageJavadocs = releaseOnTag().call() + packageJavadocs = releaseIfCmdFlag("publicRelease").call() publishIf { it.containsIgnoreCase("release") } artifactoryConfig { contextUrl = "https://muxinc.jfrog.io/artifactory/" @@ -100,7 +101,7 @@ dependencies { debugImplementation project(':library') // note- 3.30.0 and 3.30.1 are marked as broken by google, so don't use -// api 'com.google.ads.interactivemedia.v3:interactivemedia:3.29.0' + // api 'com.google.ads.interactivemedia.v3:interactivemedia:3.29.0' // implementation is used so it doesn't pollute customers namespace implementation "com.mux:utils-kt:$coreVersion" @@ -119,8 +120,12 @@ dependencies { at_1_3Api "androidx.media3:media3-exoplayer-ima:1.3.0" //noinspection GradleDependency at_1_3Api "androidx.media3:media3-exoplayer:1.3.0" - At_latestApi "androidx.media3:media3-exoplayer-ima:1.3.0" - At_latestApi "androidx.media3:media3-exoplayer:1.3.0" + //noinspection GradleDependency + at_1_4Api "androidx.media3:media3-exoplayer-ima:1.4.0" + //noinspection GradleDependency + at_1_4Api "androidx.media3:media3-exoplayer:1.4.0" + At_latestApi "androidx.media3:media3-exoplayer-ima:1.4.0" + At_latestApi "androidx.media3:media3-exoplayer:1.4.0" implementation 'androidx.core:core-ktx:1.13.1' diff --git a/library/build.gradle b/library/build.gradle index 743868d9..6d93d98e 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -44,6 +44,10 @@ android { dimension "media3" buildConfigField "String", "MEDIA3_VERSION", "\"1.3.x\"" } + at_1_4 { + dimension "media3" + buildConfigField "String", "MEDIA3_VERSION", "\"1.4.x\"" + } } buildTypes { @@ -76,7 +80,7 @@ muxDistribution { publicReleaseIf releaseIfCmdFlag("publicRelease") // TODO: This is kinda clumsy, packageJavadocs should be a function not a property probably - packageJavadocs = releaseOnTag().call() + packageJavadocs = releaseIfCmdFlag("publicRelease").call() publishIf { it.containsIgnoreCase("release") } artifactoryConfig { contextUrl = "https://muxinc.jfrog.io/artifactory/" @@ -117,9 +121,12 @@ dependencies { at_1_0Api "androidx.media3:media3-common:1.0.0" //noinspection GradleDependency at_1_1Api "androidx.media3:media3-common:1.1.0" + //noinspection GradleDependency at_1_2Api "androidx.media3:media3-common:1.2.0" + //noinspection GradleDependency at_1_3Api "androidx.media3:media3-common:1.3.0" - At_latestApi "androidx.media3:media3-common:1.3.0" + at_1_4Api "androidx.media3:media3-common:1.4.0" + At_latestApi "androidx.media3:media3-common:1.4.0" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"