Skip to content

Commit

Permalink
KUX-1761: Upgrade exoplayer to Media 3 (#161)
Browse files Browse the repository at this point in the history
* KUX-1761: Upgrade exoplayer to Media 3

* ASTRO-1204: Astro -support Android 14 in player playkit SDK

* ASTRO-1204: Astro -support Android 14 in player playkit SDK

* ASTRO-1204: Astro -support Android 14 in player playkit SDK

* Custom branch release publish updated
  • Loading branch information
volodymyr-bondarenko85 authored Dec 23, 2024
1 parent 5b60c4e commit 8165dae
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ 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()
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"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
27 changes: 18 additions & 9 deletions imaplugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
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
Expand All @@ -25,22 +34,22 @@ android {
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}
}

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
implementation 'androidx.core:core-ktx:1.9.0'
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.1'

testImplementation 'junit:junit:4.13.2'
implementation 'androidx.annotation:annotation:1.3.0'
Expand Down
4 changes: 2 additions & 2 deletions imaplugin/gradle-mvn-local.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'maven-publish'

task androidSourcesJar(type: Jar) {
classifier 'sources'
archiveClassifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}

project.afterEvaluate {
publishing {
publications {
mavenJava(MavenPublication) {
from components.release
from components.findByName('release')
}
}
repositories {
Expand Down
6 changes: 3 additions & 3 deletions imaplugin/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ afterEvaluate { project ->
publishing {
publications {
mavenJava(MavenPublication) {
from components.release
from components.findByName('release')
groupId = GROUP
artifactId = POM_ARTIFACT_ID

Expand Down Expand Up @@ -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
}

Expand Down
3 changes: 1 addition & 2 deletions imaplugin/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kaltura.playkit.plugin.ima" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
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.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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,25 @@
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.common.util.UnstableApi;
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;
Expand All @@ -47,9 +48,9 @@
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;

/**
@UnstableApi /**
* Video adPlayer that can play content video and ads.
*/
public class ExoPlayerWithAdPlayback extends RelativeLayout implements Player.Listener, ExoAdPlaybackAnalyticsListener.VideoFormatChangedListener {
Expand Down Expand Up @@ -77,7 +78,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;
Expand Down Expand Up @@ -140,8 +141,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);
Expand All @@ -153,7 +154,7 @@ public ViewGroup getAdUiContainer() {
return adUiContainer;
}

public StyledPlayerView getAdPlayerView() {
public PlayerView getAdPlayerView() {
return adVideoPlayerView;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -77,6 +78,7 @@
import java.util.List;
import java.util.Map;

@UnstableApi
/**
* Created by gilad.nadav on 17/11/2016.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
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.androidx.media3.common.util.UnstableApi;
import com.kaltura.playkit.MessageBus;
import com.kaltura.playkit.PKDrmParams;
import com.kaltura.playkit.PKError;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jdk:
- openjdk11
- openjdk17
before_install:
- curl https://kaltura.github.io/fe-tools/android/license.sh | sh

0 comments on commit 8165dae

Please sign in to comment.