From 96d4046f274d13491df03f1a401a75d3536a31a1 Mon Sep 17 00:00:00 2001 From: "volodymyr.bondarenko" Date: Wed, 20 Dec 2023 17:42:45 +0200 Subject: [PATCH 1/5] KUX-1761: Upgrade exoplayer to Media 3 --- .../ima/ExoAdPlaybackAnalyticsListener.kt | 10 ++-- .../plugins/ima/ExoPlayerWithAdPlayback.java | 46 +++++++++---------- .../playkit/plugins/imadai/IMADAIPlugin.java | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoAdPlaybackAnalyticsListener.kt b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoAdPlaybackAnalyticsListener.kt index 68214ee..46f959e 100644 --- a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoAdPlaybackAnalyticsListener.kt +++ b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoAdPlaybackAnalyticsListener.kt @@ -1,11 +1,11 @@ package com.kaltura.playkit.plugins.ima import androidx.annotation.Nullable -import com.kaltura.android.exoplayer2.Format -import com.kaltura.android.exoplayer2.analytics.AnalyticsListener -import com.kaltura.android.exoplayer2.decoder.DecoderReuseEvaluation -import com.kaltura.android.exoplayer2.trackselection.DefaultTrackSelector -import com.kaltura.android.exoplayer2.util.EventLogger +import com.kaltura.androidx.media3.common.Format +import com.kaltura.androidx.media3.exoplayer.analytics.AnalyticsListener +import com.kaltura.androidx.media3.exoplayer.DecoderReuseEvaluation +import com.kaltura.androidx.media3.exoplayer.trackselection.DefaultTrackSelector +import com.kaltura.androidx.media3.exoplayer.util.EventLogger class ExoAdPlaybackAnalyticsListener: EventLogger() { diff --git a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoPlayerWithAdPlayback.java b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoPlayerWithAdPlayback.java index 86ad11b..cc07c5c 100644 --- a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoPlayerWithAdPlayback.java +++ b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoPlayerWithAdPlayback.java @@ -17,24 +17,24 @@ import com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider; import com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer; import com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate; -import com.kaltura.android.exoplayer2.C; -import com.kaltura.android.exoplayer2.DefaultRenderersFactory; -import com.kaltura.android.exoplayer2.ExoPlayer; -import com.kaltura.android.exoplayer2.Format; -import com.kaltura.android.exoplayer2.MediaItem; -import com.kaltura.android.exoplayer2.PlaybackException; -import com.kaltura.android.exoplayer2.PlaybackParameters; -import com.kaltura.android.exoplayer2.Player; -import com.kaltura.android.exoplayer2.Timeline; -import com.kaltura.android.exoplayer2.trackselection.AdaptiveTrackSelection; -import com.kaltura.android.exoplayer2.trackselection.DefaultTrackSelector; -import com.kaltura.android.exoplayer2.ui.StyledPlayerView; -import com.kaltura.android.exoplayer2.upstream.DataSource; -import com.kaltura.android.exoplayer2.upstream.DefaultDataSource; -import com.kaltura.android.exoplayer2.upstream.DefaultHttpDataSource; -import com.kaltura.android.exoplayer2.upstream.HttpDataSource; -import com.kaltura.android.exoplayer2.util.Log; -import com.kaltura.android.exoplayer2.util.Util; +import com.kaltura.androidx.media3.common.C; +import com.kaltura.androidx.media3.exoplayer.DefaultRenderersFactory; +import com.kaltura.androidx.media3.exoplayer.ExoPlayer; +import com.kaltura.androidx.media3.common.Format; +import com.kaltura.androidx.media3.common.MediaItem; +import com.kaltura.androidx.media3.common.PlaybackException; +import com.kaltura.androidx.media3.common.PlaybackParameters; +import com.kaltura.androidx.media3.common.Player; +import com.kaltura.androidx.media3.common.Timeline; +import com.kaltura.androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection; +import com.kaltura.androidx.media3.exoplayer.trackselection.DefaultTrackSelector; +import com.kaltura.androidx.media3.ui.PlayerView; +import com.kaltura.androidx.media3.datasource.DataSource; +import com.kaltura.androidx.media3.datasource.DefaultDataSource; +import com.kaltura.androidx.media3.datasource.DefaultHttpDataSource; +import com.kaltura.androidx.media3.datasource.HttpDataSource; +import com.kaltura.androidx.media3.common.util.Log; +import com.kaltura.androidx.media3.common.util.Util; import com.kaltura.playkit.PKLog; import com.kaltura.playkit.PKMediaFormat; import com.kaltura.playkit.PlayerState; @@ -47,7 +47,7 @@ import java.util.Collections; import java.util.List; -import static com.kaltura.android.exoplayer2.util.Log.LOG_LEVEL_OFF; +import static com.kaltura.androidx.media3.common.util.Log.LOG_LEVEL_OFF; /** * Video adPlayer that can play content video and ads. @@ -77,7 +77,7 @@ public enum IMAAdState { private boolean debugEnabled; // The wrapped video adPlayerView. - private StyledPlayerView adVideoPlayerView; + private PlayerView adVideoPlayerView; // The SDK will render ad playback UI elements into this ViewGroup. private ViewGroup adUiContainer; @@ -140,8 +140,8 @@ public ExoPlayerWithAdPlayback(Context context, int adLoadTimeout, boolean debug init(); } - private StyledPlayerView createAdPlayerView() { - adVideoPlayerView = new StyledPlayerView(getContext()); + private PlayerView createAdPlayerView() { + adVideoPlayerView = new PlayerView(getContext()); adVideoPlayerView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); int id = 123456789; adVideoPlayerView.setId(id); @@ -153,7 +153,7 @@ public ViewGroup getAdUiContainer() { return adUiContainer; } - public StyledPlayerView getAdPlayerView() { + public PlayerView getAdPlayerView() { return adVideoPlayerView; } diff --git a/imaplugin/src/main/java/com/kaltura/playkit/plugins/imadai/IMADAIPlugin.java b/imaplugin/src/main/java/com/kaltura/playkit/plugins/imadai/IMADAIPlugin.java index e35469d..e298a44 100644 --- a/imaplugin/src/main/java/com/kaltura/playkit/plugins/imadai/IMADAIPlugin.java +++ b/imaplugin/src/main/java/com/kaltura/playkit/plugins/imadai/IMADAIPlugin.java @@ -21,7 +21,7 @@ import com.google.ads.interactivemedia.v3.api.player.VideoStreamPlayer; import com.google.gson.Gson; import com.google.gson.JsonObject; -import com.kaltura.android.exoplayer2.C; +import com.kaltura.androidx.media3.common.C; import com.kaltura.playkit.MessageBus; import com.kaltura.playkit.PKDrmParams; import com.kaltura.playkit.PKError; From 555ae69b596d80441a6ff6acdd9dd2cebbf57759 Mon Sep 17 00:00:00 2001 From: "volodymyr.bondarenko" Date: Tue, 1 Oct 2024 14:56:28 +0300 Subject: [PATCH 2/5] ASTRO-1204: Astro -support Android 14 in player playkit SDK --- .github/workflows/build.yml | 4 ++-- .github/workflows/publish.yml | 7 +++++++ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- imaplugin/build.gradle | 19 ++++++++++++++----- imaplugin/gradle-mvn-local.gradle | 4 ++-- imaplugin/gradle-mvn-push.gradle | 6 +++--- .../ima/ExoAdPlaybackAnalyticsListener.kt | 3 ++- .../plugins/ima/ExoPlayerWithAdPlayback.java | 3 ++- .../playkit/plugins/ima/IMAPlugin.java | 2 ++ .../playkit/plugins/imadai/IMADAIPlugin.java | 2 ++ 11 files changed, 38 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07735d9..cdf69fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,10 +20,10 @@ jobs: - name: Checkout repo and clone to CI workspace uses: actions/checkout@v3 - - name: Setup JDK 11 + - name: Setup JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'adopt' cache: 'gradle' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c74a1b8..ca62ce4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -49,6 +49,13 @@ jobs: run: | mkdir $PWD/.kltrenv && echo "${{ secrets.SIGNING_KEY }}" > $PWD/.kltrenv/secring.gpg.b64 base64 -d $PWD/.kltrenv/secring.gpg.b64 > $PWD/.kltrenv/secring.gpg + + - name: Setup JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + cache: 'gradle' - name: Run publish Script run: | diff --git a/build.gradle b/build.gradle index 5d3d291..afaced8 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ buildscript { maven { url "https://jitpack.io" } } dependencies { - classpath 'com.android.tools.build:gradle:7.2.1' + classpath 'com.android.tools.build:gradle:8.3.2' classpath 'io.github.gradle-nexus:publish-plugin:1.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e366df8..8838dc9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip diff --git a/imaplugin/build.gradle b/imaplugin/build.gradle index d1acb28..b09b8a9 100644 --- a/imaplugin/build.gradle +++ b/imaplugin/build.gradle @@ -3,20 +3,29 @@ apply plugin: 'kotlin-android' apply from: 'version.gradle' android { - compileSdkVersion 33 + namespace 'com.kaltura.playkit.plugin.ima' + compileSdk 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { - minSdkVersion 16 - targetSdkVersion 33 + minSdkVersion 21 + targetSdkVersion 34 versionName libVersion testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField("String","VERSION_NAME","\"${libVersion}\"") } - + buildFeatures { + buildConfig true + } + publishing { + publishing { + singleVariant('release') { + } + } + } buildTypes { release { minifyEnabled false @@ -40,7 +49,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" //Ads library. - api 'com.google.ads.interactivemedia.v3:interactivemedia:3.29.0' + api 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.0' testImplementation 'junit:junit:4.13.2' implementation 'androidx.annotation:annotation:1.3.0' diff --git a/imaplugin/gradle-mvn-local.gradle b/imaplugin/gradle-mvn-local.gradle index 6d0d890..389f44f 100644 --- a/imaplugin/gradle-mvn-local.gradle +++ b/imaplugin/gradle-mvn-local.gradle @@ -1,7 +1,7 @@ apply plugin: 'maven-publish' task androidSourcesJar(type: Jar) { - classifier 'sources' + archiveClassifier = 'sources' from android.sourceSets.main.java.sourceFiles } @@ -9,7 +9,7 @@ project.afterEvaluate { publishing { publications { mavenJava(MavenPublication) { - from components.release + from components.findByName('release') } } repositories { diff --git a/imaplugin/gradle-mvn-push.gradle b/imaplugin/gradle-mvn-push.gradle index e26cac0..f2c6402 100644 --- a/imaplugin/gradle-mvn-push.gradle +++ b/imaplugin/gradle-mvn-push.gradle @@ -27,7 +27,7 @@ afterEvaluate { project -> publishing { publications { mavenJava(MavenPublication) { - from components.release + from components.findByName('release') groupId = GROUP artifactId = POM_ARTIFACT_ID @@ -97,12 +97,12 @@ afterEvaluate { project -> } task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - classifier 'javadoc' + archiveClassifier = 'javadoc' from androidJavadocs.destinationDir } task androidSourcesJar(type: Jar) { - classifier 'sources' + archiveClassifier = 'sources' from android.sourceSets.main.java.sourceFiles } diff --git a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoAdPlaybackAnalyticsListener.kt b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoAdPlaybackAnalyticsListener.kt index 46f959e..80ca66c 100644 --- a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoAdPlaybackAnalyticsListener.kt +++ b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoAdPlaybackAnalyticsListener.kt @@ -2,12 +2,13 @@ package com.kaltura.playkit.plugins.ima import androidx.annotation.Nullable import com.kaltura.androidx.media3.common.Format +import com.kaltura.androidx.media3.common.util.UnstableApi import com.kaltura.androidx.media3.exoplayer.analytics.AnalyticsListener import com.kaltura.androidx.media3.exoplayer.DecoderReuseEvaluation import com.kaltura.androidx.media3.exoplayer.trackselection.DefaultTrackSelector import com.kaltura.androidx.media3.exoplayer.util.EventLogger -class ExoAdPlaybackAnalyticsListener: EventLogger() { +@UnstableApi class ExoAdPlaybackAnalyticsListener: EventLogger() { interface VideoFormatChangedListener { fun videoFormatChanged(format: Format) diff --git a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoPlayerWithAdPlayback.java b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoPlayerWithAdPlayback.java index cc07c5c..b15830a 100644 --- a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoPlayerWithAdPlayback.java +++ b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/ExoPlayerWithAdPlayback.java @@ -18,6 +18,7 @@ import com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer; import com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate; import com.kaltura.androidx.media3.common.C; +import com.kaltura.androidx.media3.common.util.UnstableApi; import com.kaltura.androidx.media3.exoplayer.DefaultRenderersFactory; import com.kaltura.androidx.media3.exoplayer.ExoPlayer; import com.kaltura.androidx.media3.common.Format; @@ -49,7 +50,7 @@ import static com.kaltura.androidx.media3.common.util.Log.LOG_LEVEL_OFF; -/** +@UnstableApi /** * Video adPlayer that can play content video and ads. */ public class ExoPlayerWithAdPlayback extends RelativeLayout implements Player.Listener, ExoAdPlaybackAnalyticsListener.VideoFormatChangedListener { diff --git a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/IMAPlugin.java b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/IMAPlugin.java index fb0fa4f..708507c 100644 --- a/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/IMAPlugin.java +++ b/imaplugin/src/main/java/com/kaltura/playkit/plugins/ima/IMAPlugin.java @@ -37,6 +37,7 @@ import com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer; import com.google.gson.Gson; import com.google.gson.JsonObject; +import com.kaltura.androidx.media3.common.util.UnstableApi; import com.kaltura.playkit.MessageBus; import com.kaltura.playkit.PKError; import com.kaltura.playkit.PKErrorCategory; @@ -77,6 +78,7 @@ import java.util.List; import java.util.Map; +@UnstableApi /** * Created by gilad.nadav on 17/11/2016. */ diff --git a/imaplugin/src/main/java/com/kaltura/playkit/plugins/imadai/IMADAIPlugin.java b/imaplugin/src/main/java/com/kaltura/playkit/plugins/imadai/IMADAIPlugin.java index e298a44..8c8f91e 100644 --- a/imaplugin/src/main/java/com/kaltura/playkit/plugins/imadai/IMADAIPlugin.java +++ b/imaplugin/src/main/java/com/kaltura/playkit/plugins/imadai/IMADAIPlugin.java @@ -22,6 +22,7 @@ import com.google.gson.Gson; import com.google.gson.JsonObject; import com.kaltura.androidx.media3.common.C; +import com.kaltura.androidx.media3.common.util.UnstableApi; import com.kaltura.playkit.MessageBus; import com.kaltura.playkit.PKDrmParams; import com.kaltura.playkit.PKError; @@ -66,6 +67,7 @@ import java.util.ListIterator; import java.util.Map; +@UnstableApi public class IMADAIPlugin extends PKPlugin implements com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, AdErrorEvent.AdErrorListener, AdsProvider { private static final PKLog log = PKLog.get("IMADAIPlugin"); private static final int KB_MULTIPLIER = 1024; From bec4d0e7af0c05d0269d64cc817a82d7e9d51621 Mon Sep 17 00:00:00 2001 From: "volodymyr.bondarenko" Date: Tue, 1 Oct 2024 15:26:31 +0300 Subject: [PATCH 3/5] ASTRO-1204: Astro -support Android 14 in player playkit SDK --- imaplugin/build.gradle | 4 ++-- jitpack.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/imaplugin/build.gradle b/imaplugin/build.gradle index b09b8a9..d5f13e4 100644 --- a/imaplugin/build.gradle +++ b/imaplugin/build.gradle @@ -41,7 +41,7 @@ android { dependencies { // TODO: when playkit without plugins is released, replace this. - implementation 'com.kaltura:playkit-android:dev-SNAPSHOT' + implementation 'com.kaltura:playkit-android:KUX-1761-SNAPSHOT' //implementation project(":playkit") // Kotlin Config @@ -49,7 +49,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" //Ads library. - api 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.0' + api 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.1' testImplementation 'junit:junit:4.13.2' implementation 'androidx.annotation:annotation:1.3.0' diff --git a/jitpack.yml b/jitpack.yml index 4f7b3d4..e86ad33 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,5 +1,5 @@ jdk: - - openjdk11 + - openjdk17 before_install: - curl https://kaltura.github.io/fe-tools/android/license.sh | sh From 436b9d946f54303022322d6cbba4692c85f34c19 Mon Sep 17 00:00:00 2001 From: "volodymyr.bondarenko" Date: Thu, 3 Oct 2024 18:22:51 +0300 Subject: [PATCH 4/5] ASTRO-1204: Astro -support Android 14 in player playkit SDK --- build.gradle | 2 +- imaplugin/build.gradle | 6 +++--- imaplugin/src/main/AndroidManifest.xml | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index afaced8..81fe88f 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ ext["signingKeyId"] = System.getenv('SIGNING_KEYID') ext["signingPassword"] = System.getenv('SIGNING_PASSWORD') buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.8.0' repositories { google() mavenCentral() diff --git a/imaplugin/build.gradle b/imaplugin/build.gradle index d5f13e4..6caac8b 100644 --- a/imaplugin/build.gradle +++ b/imaplugin/build.gradle @@ -6,8 +6,8 @@ android { namespace 'com.kaltura.playkit.plugin.ima' compileSdk 34 compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } defaultConfig { minSdkVersion 21 @@ -34,7 +34,7 @@ android { } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } } diff --git a/imaplugin/src/main/AndroidManifest.xml b/imaplugin/src/main/AndroidManifest.xml index 1b1305a..94cbbcf 100644 --- a/imaplugin/src/main/AndroidManifest.xml +++ b/imaplugin/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + From 6a1fc4a5524c4bccf47ff49a5a17e5cff152d35c Mon Sep 17 00:00:00 2001 From: "volodymyr.bondarenko" Date: Wed, 27 Nov 2024 14:43:02 +0200 Subject: [PATCH 5/5] Custom branch release publish updated --- .github/publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/publish.sh b/.github/publish.sh index 07160a3..d88f3af 100644 --- a/.github/publish.sh +++ b/.github/publish.sh @@ -42,7 +42,7 @@ set_version() { fi if [ "$RELEASE_TYPE" == "Full" ]; then echo "RELEASE_TYPE = '$RELEASE_TYPE'" - perl -pi -e "s/:playkit-android:dev-SNAPSHOT/.playkit:playkit:$NEW_VERSION/" $BUILD_GRADLE + perl -pi -e "s/:playkit-android:.*?-SNAPSHOT/.playkit:playkit:$NEW_VERSION/" $BUILD_GRADLE fi }