Skip to content

Commit 22d2bcb

Browse files
authored
Migrate video player to Media3
1 parent fab46bc commit 22d2bcb

File tree

9 files changed

+30
-19
lines changed

9 files changed

+30
-19
lines changed

all/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 31
4+
compileSdkVersion 33
55
buildToolsVersion "30.0.2"
66

77

88
defaultConfig {
99
minSdkVersion 19
10-
targetSdkVersion 31
10+
targetSdkVersion 33
1111
versionCode 1
1212
versionName "1.0"
1313
multiDexEnabled true

core/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 31
4+
compileSdkVersion 33
55
buildToolsVersion "30.0.2"
66

77

88
defaultConfig {
99
minSdkVersion 19
10-
targetSdkVersion 31
10+
targetSdkVersion 33
1111
versionCode 1
1212
versionName "1.0"
1313
multiDexEnabled true

download/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 31
4+
compileSdkVersion 33
55
buildToolsVersion "30.0.2"
66

77
defaultConfig {
88
minSdkVersion 19
9-
targetSdkVersion 31
9+
targetSdkVersion 33
1010
versionCode 1
1111
versionName "1.0"
1212
multiDexEnabled true

glide-integration/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 31
4+
compileSdkVersion 33
55
buildToolsVersion "30.0.2"
66

77
defaultConfig {
88
minSdkVersion 19
9-
targetSdkVersion 30
9+
targetSdkVersion 33
1010
versionCode 1
1111
versionName "1.0"
1212
multiDexEnabled true

preprocess/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 31
4+
compileSdkVersion 33
55
buildToolsVersion "30.0.2"
66

77
defaultConfig {
88
minSdkVersion 19
9-
targetSdkVersion 31
9+
targetSdkVersion 33
1010
versionCode 1
1111
versionName "1.0"
1212
android.compileOptions.sourceCompatibility 1.8

sample/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 31
4+
compileSdkVersion 33
55
buildToolsVersion "30.0.2"
66

77
defaultConfig {
88
applicationId "com.cloudinary.android.sample"
99
minSdkVersion 19
10-
targetSdkVersion 31
10+
targetSdkVersion 33
1111
versionCode 1
1212
versionName "1.0"
1313
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

ui/build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 31
4+
compileSdkVersion 33
55
buildToolsVersion "30.0.2"
66

77

88
defaultConfig {
99
minSdkVersion 19
10-
targetSdkVersion 31
10+
targetSdkVersion 33
1111
versionCode 1
1212
versionName "1.0"
1313
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -35,7 +35,10 @@ dependencies {
3535
implementation project(':core')
3636
implementation project(':preprocess')
3737

38-
implementation 'com.google.android.exoplayer:exoplayer:2.16.0'
38+
implementation 'androidx.media3:media3-exoplayer:1.1.1'
39+
implementation 'androidx.media3:media3-exoplayer-dash:1.1.1'
40+
implementation 'androidx.media3:media3-exoplayer-hls:1.1.1'
41+
implementation 'androidx.media3:media3-ui:1.1.1'
3942

4043
implementation 'androidx.appcompat:appcompat:1.3.0'
4144
implementation 'com.google.android.material:material:1.4.0'

sample/src/androidTest/java/cloudinary/android/sample/CldVideoPlayerInstrumentedTest.java renamed to ui/src/androidTest/java/cloudinary/android/ui/CldVideoPlayerInstrumentedTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cloudinary.android.sample;
1+
package cloudinary.android.ui;
22

33
import android.content.Context;
44
import android.os.Handler;
@@ -9,10 +9,11 @@
99
import androidx.test.runner.AndroidJUnit4;
1010

1111
import com.cloudinary.Transformation;
12+
import com.cloudinary.android.MediaManager;
1213
import com.cloudinary.android.cldvideoplayer.CldVideoPlayer;
13-
import com.google.android.exoplayer2.ExoPlayer;
1414

1515
import org.junit.Before;
16+
import org.junit.BeforeClass;
1617
import org.junit.Test;
1718
import org.junit.runner.RunWith;
1819

@@ -27,6 +28,12 @@ public class CldVideoPlayerInstrumentedTest {
2728

2829
private Context context;
2930

31+
@BeforeClass
32+
public synchronized static void initLibrary() {
33+
MediaManager.init(InstrumentationRegistry.getInstrumentation().getTargetContext());
34+
MediaManager.get().getCloudinary().config.cloudName = "demo";
35+
}
36+
3037
@Before
3138
public void setUp() {
3239
context = InstrumentationRegistry.getInstrumentation().getTargetContext();

ui/src/main/java/com/cloudinary/android/cldvideoplayer/CldVideoPlayer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
import android.content.Context;
44
import android.util.Log;
55

6+
import androidx.media3.common.MediaItem;
7+
import androidx.media3.exoplayer.ExoPlayer;
8+
69
import com.cloudinary.Cloudinary;
710
import com.cloudinary.Transformation;
811
import com.cloudinary.android.MediaManager;
9-
import com.google.android.exoplayer2.ExoPlayer;
10-
import com.google.android.exoplayer2.MediaItem;
1112

1213
import java.net.URL;
1314

0 commit comments

Comments
 (0)