@@ -38,6 +38,19 @@ android {
3838 matchingFallbacks + = listOf (" debug" )
3939 }
4040 }
41+
42+ flavorDimensions + = " player"
43+ productFlavors {
44+ create(" latestPlayer" ) {
45+ // Use the latest supported THEOplayer version
46+ dimension = " player"
47+ }
48+ create(" minPlayer" ) {
49+ // Use the minimum supported THEOplayer version
50+ dimension = " player"
51+ }
52+ }
53+
4154 compileOptions {
4255 sourceCompatibility = JavaVersion .VERSION_1_8
4356 targetCompatibility = JavaVersion .VERSION_1_8
@@ -59,6 +72,10 @@ android {
5972}
6073
6174dependencies {
75+ val mavenImplementation = configurations.getByName(" mavenImplementation" )
76+ val latestPlayerImplementation = configurations.getByName(" latestPlayerImplementation" )
77+ val minPlayerImplementation = configurations.getByName(" minPlayerImplementation" )
78+
6279 implementation(platform(libs.androidx.compose.bom))
6380
6481 implementation(libs.androidx.ktx)
@@ -80,30 +97,13 @@ dependencies {
8097
8198 debugImplementation(project(" :ui" ))
8299 releaseImplementation(project(" :ui" ))
83- " mavenImplementation" (" com.theoplayer.android-ui:android-ui:1.+" )
100+ mavenImplementation(" com.theoplayer.android-ui:android-ui:1.+" )
84101
85- implementation(libs.theoplayer) {
86- useLowestSupportedPlayerVersion()
87- }
88- implementation(libs.theoplayer.ads.ima) {
89- useLowestSupportedPlayerVersion()
90- }
91- implementation(libs.theoplayer.cast) {
92- useLowestSupportedPlayerVersion()
93- }
94- }
102+ latestPlayerImplementation(libs.theoplayer)
103+ latestPlayerImplementation(libs.theoplayer.ads.ima)
104+ latestPlayerImplementation(libs.theoplayer.cast)
95105
96- val installLowestSupportedPlayerVersion: String by project.ext
97-
98- fun ExternalDependency.useLowestSupportedPlayerVersion () {
99- if (installLowestSupportedPlayerVersion.toBooleanStrict()) {
100- val lowestVersion = versionConstraint.strictVersion
101- .removePrefix(" [" )
102- .split(" ," , limit = 2 )
103- .first()
104- version {
105- prefer(lowestVersion)
106- strictly(lowestVersion)
107- }
108- }
106+ minPlayerImplementation(libs.theoplayer.min)
107+ minPlayerImplementation(libs.theoplayer.min.ads.ima)
108+ minPlayerImplementation(libs.theoplayer.min.cast)
109109}
0 commit comments