From 25f0995d0179b1ddda67f7b162e807dff460533b Mon Sep 17 00:00:00 2001 From: Akihiro Sakahara Date: Mon, 6 Jan 2020 17:45:30 +0900 Subject: [PATCH 01/11] Update ExoPlayer and Gradle version. --- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index e52f6bfa..3c65cde8 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.2' + classpath 'com.android.tools.build:gradle:3.5.3' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' } } @@ -17,6 +17,6 @@ allprojects { } ext { - exoPlayerVersion = "2.9.6" + exoPlayerVersion = "2.10.8" supportLibVersion = "28.0.0" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0b3fb8d..5028f28f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From e90343e91941d8d0727781ff159cf5975a3a9d90 Mon Sep 17 00:00:00 2001 From: Akihiro Sakahara Date: Mon, 6 Jan 2020 17:46:44 +0900 Subject: [PATCH 02/11] Fix Gradle error. --- library/gradle/publish.gradle | 76 ++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/library/gradle/publish.gradle b/library/gradle/publish.gradle index 674efaab..4124da70 100644 --- a/library/gradle/publish.gradle +++ b/library/gradle/publish.gradle @@ -29,49 +29,51 @@ task androidSourcesJar(type: Jar) { * Bintray Deploy * `$ ./gradlew clean library:assembleRelease androidJavaDocJar androidSourcesJar generatePomFileForJcenterPublication bintrayUpload` */ -publishing { - publications { - jcenter(MavenPublication) { - groupId project.getLibraryInfo().groupId - artifactId project.getLibraryInfo().artifactId - version project.getLibraryInfo().versionName +project.afterEvaluate { + publishing { + publications { + jcenter(MavenPublication) { + groupId project.getLibraryInfo().groupId + artifactId project.getLibraryInfo().artifactId + version project.getLibraryInfo().versionName - artifact bundleReleaseAar - artifact androidJavaDocJar - artifact androidSourcesJar + artifact bundleReleaseAar + artifact androidJavaDocJar + artifact androidSourcesJar - // The generated POM doesn't include dependencies when building Android artifacts, so we manually - // add the dependencies to the POM here - pom.withXml { - def rootNode = asNode().appendNode('dependencies') + // The generated POM doesn't include dependencies when building Android artifacts, so we manually + // add the dependencies to the POM here + pom.withXml { + def rootNode = asNode().appendNode('dependencies') - /** - * Helper method to add dependencies to the POM node - */ - ext.addDependency = { Node dependenciesNode, Dependency dependency, String dependencyScope-> - // We don't add incomplete dependencies - if (dependency.name == null || - dependency.name == 'unspecified' || - dependency.group == null || - dependency.version == null) { - return - } + /** + * Helper method to add dependencies to the POM node + */ + ext.addDependency = { Node dependenciesNode, Dependency dependency, String dependencyScope -> + // We don't add incomplete dependencies + if (dependency.name == null || + dependency.name == 'unspecified' || + dependency.group == null || + dependency.version == null) { + return + } - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', dependency.group) - dependencyNode.appendNode('artifactId', dependency.name) - dependencyNode.appendNode('version', dependency.version) - dependencyNode.appendNode('scope', dependencyScope) - } + def dependencyNode = dependenciesNode.appendNode('dependency') + dependencyNode.appendNode('groupId', dependency.group) + dependencyNode.appendNode('artifactId', dependency.name) + dependencyNode.appendNode('version', dependency.version) + dependencyNode.appendNode('scope', dependencyScope) + } - // Iterate over the implementation dependencies, adding a node for each - configurations.implementation.dependencies.each { - addDependency(rootNode, it, "runtime") - } + // Iterate over the implementation dependencies, adding a node for each + configurations.implementation.dependencies.each { + addDependency(rootNode, it, "runtime") + } - // Iterate over the api dependencies, adding a node for each - configurations.api.dependencies.each { - addDependency(rootNode, it, "compile") + // Iterate over the api dependencies, adding a node for each + configurations.api.dependencies.each { + addDependency(rootNode, it, "compile") + } } } } From d1a241dc5fc02e59da488ee1cb650244cbb53057 Mon Sep 17 00:00:00 2001 From: Akihiro Sakahara Date: Mon, 6 Jan 2020 17:49:36 +0900 Subject: [PATCH 03/11] Fix build error. --- .../android/exomedia/core/exoplayer/ExoMediaPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java index 428cac32..a66bb48f 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java @@ -169,7 +169,7 @@ public ExoMediaPlayer(@NonNull Context context) { trackSelector = new DefaultTrackSelector(adaptiveTrackSelectionFactory); LoadControl loadControl = ExoMedia.Data.loadControl != null ? ExoMedia.Data.loadControl : new DefaultLoadControl(); - player = ExoPlayerFactory.newInstance(renderers.toArray(new Renderer[renderers.size()]), trackSelector, loadControl); + player = ExoPlayerFactory.newInstance(context, renderers.toArray(new Renderer[renderers.size()]), trackSelector, loadControl); player.addListener(this); analyticsCollector = new AnalyticsCollector.Factory().createAnalyticsCollector(player, Clock.DEFAULT); player.addListener(analyticsCollector); From 29aa4ed3e3ab7f808a532048415629f5f8e66ce6 Mon Sep 17 00:00:00 2001 From: Akihiro Sakahara Date: Mon, 6 Jan 2020 17:56:44 +0900 Subject: [PATCH 04/11] Replace deprecated methods. --- .../android/exomedia/core/exoplayer/ExoMediaPlayer.java | 7 ++++--- .../core/source/builder/DefaultMediaSourceBuilder.java | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java index a66bb48f..ac4c6f85 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java @@ -90,7 +90,7 @@ import java.util.concurrent.atomic.AtomicBoolean; @SuppressWarnings({"unused", "WeakerAccess"}) -public class ExoMediaPlayer extends Player.DefaultEventListener { +public class ExoMediaPlayer implements Player.EventListener { private static final String TAG = "ExoMediaPlayer"; private static final int BUFFER_REPEAT_DELAY = 1_000; private static final int WAKE_LOCK_TIMEOUT = 1_000; @@ -126,7 +126,7 @@ public class ExoMediaPlayer extends Player.DefaultEventListener { @NonNull private List renderers; @NonNull - private DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); + private DefaultBandwidthMeter bandwidthMeter; @Nullable private CaptionListener captionListener; @@ -165,8 +165,9 @@ public ExoMediaPlayer(@NonNull Context context) { renderers = rendererProvider.generate(); - adaptiveTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter); + adaptiveTrackSelectionFactory = new AdaptiveTrackSelection.Factory(); trackSelector = new DefaultTrackSelector(adaptiveTrackSelectionFactory); + bandwidthMeter = new DefaultBandwidthMeter.Builder(context).build(); LoadControl loadControl = ExoMedia.Data.loadControl != null ? ExoMedia.Data.loadControl : new DefaultLoadControl(); player = ExoPlayerFactory.newInstance(context, renderers.toArray(new Renderer[renderers.size()]), trackSelector, loadControl); diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DefaultMediaSourceBuilder.java b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DefaultMediaSourceBuilder.java index 776f4272..7ae9e67a 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DefaultMediaSourceBuilder.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DefaultMediaSourceBuilder.java @@ -23,8 +23,8 @@ import android.support.annotation.Nullable; import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory; -import com.google.android.exoplayer2.source.ExtractorMediaSource; import com.google.android.exoplayer2.source.MediaSource; +import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.TransferListener; @@ -34,8 +34,7 @@ public class DefaultMediaSourceBuilder extends MediaSourceBuilder { public MediaSource build(@NonNull Context context, @NonNull Uri uri, @NonNull String userAgent, @NonNull Handler handler, @Nullable TransferListener transferListener) { DataSource.Factory dataSourceFactory = buildDataSourceFactory(context, userAgent, transferListener); - return new ExtractorMediaSource.Factory(dataSourceFactory) - .setExtractorsFactory(new DefaultExtractorsFactory()) + return new ProgressiveMediaSource.Factory(dataSourceFactory, new DefaultExtractorsFactory()) .createMediaSource(uri); } } From 7a8a499b3540693380930d51c9b9bc6bc47a8ff7 Mon Sep 17 00:00:00 2001 From: Akihiro Sakahara Date: Mon, 6 Jan 2020 17:59:37 +0900 Subject: [PATCH 05/11] Replace deprecated methods in demo. --- .../main/kotlin/com/devbrackets/android/exomediademo/App.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt index 5478b681..5a767f29 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt @@ -3,6 +3,8 @@ package com.devbrackets.android.exomediademo import android.app.Application import com.devbrackets.android.exomedia.ExoMedia import com.devbrackets.android.exomediademo.manager.PlaylistManager +import com.google.android.exoplayer2.database.DatabaseProvider +import com.google.android.exoplayer2.database.ExoDatabaseProvider import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSourceFactory import com.google.android.exoplayer2.upstream.DataSource import com.google.android.exoplayer2.upstream.TransferListener @@ -16,6 +18,7 @@ import java.io.File class App : Application() { val playlistManager: PlaylistManager by lazy { PlaylistManager(this) } + private lateinit var databaseProvider: DatabaseProvider override fun onCreate() { super.onCreate() @@ -25,6 +28,7 @@ class App : Application() { } private fun configureExoMedia() { + databaseProvider = ExoDatabaseProvider(this) // Registers the media sources to use the OkHttp client instead of the standard Apache one // Note: the OkHttpDataSourceFactory can be found in the ExoPlayer extension library `extension-okhttp` ExoMedia.setDataSourceFactoryProvider(object : ExoMedia.DataSourceFactoryProvider { @@ -36,7 +40,7 @@ class App : Application() { val upstreamFactory = OkHttpDataSourceFactory(OkHttpClient(), userAgent, listener) // Adds a cache around the upstreamFactory - val cache = SimpleCache(File(cacheDir, "ExoMediaCache"), LeastRecentlyUsedCacheEvictor((50 * 1024 * 1024).toLong())) + val cache = SimpleCache(File(cacheDir, "ExoMediaCache"), LeastRecentlyUsedCacheEvictor((50 * 1024 * 1024).toLong()), databaseProvider) instance = CacheDataSourceFactory(cache, upstreamFactory, CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR) } From f4a0b190b0edac2eb34e430c64c9a4567d66eeb9 Mon Sep 17 00:00:00 2001 From: Akihiro Sakahara Date: Mon, 6 Jan 2020 18:04:47 +0900 Subject: [PATCH 06/11] Change some valid sample urls to https. --- .../com/devbrackets/android/exomediademo/data/Samples.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/data/Samples.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/data/Samples.kt index 401c436e..5a97ec4f 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/data/Samples.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/data/Samples.kt @@ -19,15 +19,15 @@ object Samples { //Video items videoSamples = ArrayList() - videoSamples.add(Sample("FLV - Big Buck Bunny by Blender", "http://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0")) + videoSamples.add(Sample("FLV - Big Buck Bunny by Blender", "https://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0")) videoSamples.add(Sample("HLS - ArtBeats", "http://cdn-fms.rbs.com.br/vod/hls_sample1_manifest.m3u8")) videoSamples.add(Sample("HLS - Sintel by Blender", "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8")) - videoSamples.add(Sample("MKV - Android Screens", "http://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv")) + videoSamples.add(Sample("MKV - Android Screens", "https://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv")) videoSamples.add(Sample("MP4 (VP9) - Google Glass", "http://demos.webmproject.org/exoplayer/glass.mp4")) videoSamples.add(Sample("MPEG DASH - Sintel by Blender", "https://bitdash-a.akamaihd.net/content/sintel/sintel.mpd")) videoSamples.add(Sample("MPEG DASH - Big Buck Bunny by Blender, Live", "https://wowzaec2demo.streamlock.net/live/bigbuckbunny/manifest_mpm4sav_mvtime.mpd")) - videoSamples.add(Sample("Smooth Stream - Caminandes: Llama Drama by Blender", "http://amssamples.streaming.mediaservices.windows.net/634cd01c-6822-4630-8444-8dd6279f94c6/CaminandesLlamaDrama4K.ism/manifest")) - videoSamples.add(Sample("Smooth Stream - Tears of Steel Teaser by Blender", "http://amssamples.streaming.mediaservices.windows.net/3d7eaff9-39fa-442f-81cc-f2ea7db1797e/TearsOfSteelTeaser.ism/manifest")) + videoSamples.add(Sample("Smooth Stream - Caminandes: Llama Drama by Blender", "https://amssamples.streaming.mediaservices.windows.net/634cd01c-6822-4630-8444-8dd6279f94c6/CaminandesLlamaDrama4K.ism/manifest")) + videoSamples.add(Sample("Smooth Stream - Tears of Steel Teaser by Blender", "https://amssamples.streaming.mediaservices.windows.net/3d7eaff9-39fa-442f-81cc-f2ea7db1797e/TearsOfSteelTeaser.ism/manifest")) videoSamples.add(Sample("WEBM - Big Buck Bunny", "http://dl1.webmfiles.org/big-buck-bunny_trailer.webm")) videoSamples.add(Sample("WEBM - Elephants Dream", "http://dl1.webmfiles.org/elephants-dream.webm")) } From e2d3496816efbb6b449f37a9d45c941a733d6c5b Mon Sep 17 00:00:00 2001 From: Akihiro Sakahara Date: Mon, 6 Jan 2020 18:26:11 +0900 Subject: [PATCH 07/11] Add bandwidthMeter to player. --- .../android/exomedia/core/exoplayer/ExoMediaPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java index ac4c6f85..fd11372d 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java @@ -170,7 +170,7 @@ public ExoMediaPlayer(@NonNull Context context) { bandwidthMeter = new DefaultBandwidthMeter.Builder(context).build(); LoadControl loadControl = ExoMedia.Data.loadControl != null ? ExoMedia.Data.loadControl : new DefaultLoadControl(); - player = ExoPlayerFactory.newInstance(context, renderers.toArray(new Renderer[renderers.size()]), trackSelector, loadControl); + player = ExoPlayerFactory.newInstance(context, renderers.toArray(new Renderer[renderers.size()]), trackSelector, loadControl, bandwidthMeter, Util.getLooper()); player.addListener(this); analyticsCollector = new AnalyticsCollector.Factory().createAnalyticsCollector(player, Clock.DEFAULT); player.addListener(analyticsCollector); From cac1ad926b930bc5b63d1b4cd171739970539516 Mon Sep 17 00:00:00 2001 From: dgelormini Date: Thu, 3 Sep 2020 16:31:48 -0400 Subject: [PATCH 08/11] Update exoplayer to 2.10.3, migrate to androidx, bump kotlin --- build.gradle | 4 ++-- demo/build.gradle | 6 +++--- .../android/exomediademo/playlist/AudioApi.kt | 4 ++-- .../android/exomediademo/playlist/VideoApi.kt | 4 ++-- .../ui/activity/AudioPlayerActivity.kt | 2 +- .../ui/activity/AudioSelectionActivity.kt | 2 +- .../exomediademo/ui/activity/StartupActivity.kt | 2 +- .../ui/activity/VideoPlayerActivity.kt | 4 ++-- .../ui/activity/VideoSelectionActivity.kt | 2 +- .../ui/subtitle/AspectRatioFrameLayout.kt | 2 +- demo/src/main/res/layout/audio_player_activity.xml | 8 ++++---- gradle.properties | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- library/build.gradle | 4 ++-- .../devbrackets/android/exomedia/AudioPlayer.java | 6 +++--- .../com/devbrackets/android/exomedia/ExoMedia.java | 4 ++-- .../android/exomedia/core/ListenerMux.java | 6 +++--- .../android/exomedia/core/api/AudioPlayerApi.java | 8 ++++---- .../android/exomedia/core/api/VideoViewApi.java | 8 ++++---- .../exomedia/core/audio/ExoAudioPlayer.java | 8 ++++---- .../exomedia/core/audio/NativeAudioPlayer.java | 8 ++++---- .../exomedia/core/exoplayer/ExoMediaPlayer.java | 10 +++++----- .../exomedia/core/exoplayer/WindowInfo.java | 2 +- .../exomedia/core/renderer/RendererProvider.java | 4 ++-- .../exomedia/core/source/MediaSourceProvider.java | 4 ++-- .../source/builder/DashMediaSourceBuilder.java | 4 ++-- .../source/builder/DefaultMediaSourceBuilder.java | 4 ++-- .../core/source/builder/HlsMediaSourceBuilder.java | 4 ++-- .../core/source/builder/MediaSourceBuilder.java | 4 ++-- .../core/source/builder/SsMediaSourceBuilder.java | 4 ++-- .../exomedia/core/video/ResizingSurfaceView.java | 6 +++--- .../exomedia/core/video/ResizingTextureView.java | 6 +++--- .../core/video/exo/ExoSurfaceVideoView.java | 8 ++++---- .../core/video/exo/ExoTextureVideoView.java | 8 ++++---- .../exomedia/core/video/exo/ExoVideoDelegate.java | 8 ++++---- .../core/video/mp/NativeSurfaceVideoView.java | 6 +++--- .../core/video/mp/NativeTextureVideoView.java | 6 +++--- .../core/video/mp/NativeVideoDelegate.java | 6 +++--- .../exomedia/core/video/scale/MatrixManager.java | 6 +++--- .../exomedia/core/video/scale/ScaleType.java | 2 +- .../exomedia/listener/OnBufferUpdateListener.java | 2 +- .../ui/animation/BottomViewHideShowAnimation.java | 4 ++-- .../ui/animation/TopViewHideShowAnimation.java | 4 ++-- .../ui/widget/FitsSystemWindowRelativeLayout.java | 2 +- .../android/exomedia/ui/widget/VideoControls.java | 10 +++++----- .../exomedia/ui/widget/VideoControlsCore.java | 4 ++-- .../exomedia/ui/widget/VideoControlsLeanback.java | 2 +- .../exomedia/ui/widget/VideoControlsMobile.java | 4 ++-- .../android/exomedia/ui/widget/VideoView.java | 12 ++++++------ .../android/exomedia/util/DeviceUtil.java | 2 +- .../android/exomedia/util/MediaSourceUtil.java | 4 ++-- .../android/exomedia/util/Repeater.java | 2 +- .../android/exomedia/util/ResourceUtil.java | 14 +++++++------- .../android/exomedia/util/StopWatch.java | 4 ++-- 54 files changed, 135 insertions(+), 133 deletions(-) create mode 100644 gradle.properties diff --git a/build.gradle b/build.gradle index 3c65cde8..3d9b4889 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' } } @@ -17,6 +17,6 @@ allprojects { } ext { - exoPlayerVersion = "2.10.8" + exoPlayerVersion = "2.10.3" supportLibVersion = "28.0.0" } diff --git a/demo/build.gradle b/demo/build.gradle index 79fc8d4e..81245d56 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlinVersion = '1.3.10' + ext.kotlinVersion = '1.3.72' repositories { google() jcenter() @@ -18,8 +18,8 @@ dependencies { implementation project(':library') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" - implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibVersion" - implementation "com.android.support:support-media-compat:$rootProject.ext.supportLibVersion" + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'androidx.media:media:1.0.0' implementation "com.google.android.exoplayer:extension-okhttp:$rootProject.ext.exoPlayerVersion" // Image Loading diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/playlist/AudioApi.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/playlist/AudioApi.kt index 73e0d900..59f7b2b3 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/playlist/AudioApi.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/playlist/AudioApi.kt @@ -4,8 +4,8 @@ import android.content.Context import android.media.AudioManager import android.net.Uri import android.os.PowerManager -import android.support.annotation.FloatRange -import android.support.annotation.IntRange +import androidx.annotation.FloatRange +import androidx.annotation.IntRange import com.devbrackets.android.exomedia.AudioPlayer import com.devbrackets.android.exomediademo.data.MediaItem diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/playlist/VideoApi.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/playlist/VideoApi.kt index a244444d..e16beeb0 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/playlist/VideoApi.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/playlist/VideoApi.kt @@ -1,8 +1,8 @@ package com.devbrackets.android.exomediademo.playlist import android.net.Uri -import android.support.annotation.FloatRange -import android.support.annotation.IntRange +import androidx.annotation.FloatRange +import androidx.annotation.IntRange import com.devbrackets.android.exomedia.ui.widget.VideoView import com.devbrackets.android.exomediademo.data.MediaItem import com.devbrackets.android.playlistcore.data.PlaybackState diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/AudioPlayerActivity.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/AudioPlayerActivity.kt index 3ed7a91d..ad4c3458 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/AudioPlayerActivity.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/AudioPlayerActivity.kt @@ -1,7 +1,7 @@ package com.devbrackets.android.exomediademo.ui.activity import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import android.view.View import android.widget.SeekBar import com.bumptech.glide.Glide diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/AudioSelectionActivity.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/AudioSelectionActivity.kt index ea9bcbc5..405d541e 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/AudioSelectionActivity.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/AudioSelectionActivity.kt @@ -2,7 +2,7 @@ package com.devbrackets.android.exomediademo.ui.activity import android.content.Intent import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import android.view.View import android.widget.AdapterView import android.widget.ListView diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/StartupActivity.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/StartupActivity.kt index 0f2e29e8..fe92f57e 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/StartupActivity.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/StartupActivity.kt @@ -2,7 +2,7 @@ package com.devbrackets.android.exomediademo.ui.activity import android.content.Intent import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import android.view.View import android.widget.AdapterView import android.widget.ListView diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/VideoPlayerActivity.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/VideoPlayerActivity.kt index 3f477c16..0ce04d70 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/VideoPlayerActivity.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/VideoPlayerActivity.kt @@ -2,8 +2,8 @@ package com.devbrackets.android.exomediademo.ui.activity import android.app.Activity import android.os.Bundle -import android.support.v7.widget.AppCompatImageButton -import android.support.v7.widget.PopupMenu +import androidx.appcompat.widget.AppCompatImageButton +import androidx.appcompat.widget.PopupMenu import android.util.Log import android.view.MenuItem import com.devbrackets.android.exomedia.ExoMedia diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/VideoSelectionActivity.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/VideoSelectionActivity.kt index 52a99dac..31b6ec1c 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/VideoSelectionActivity.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/activity/VideoSelectionActivity.kt @@ -2,7 +2,7 @@ package com.devbrackets.android.exomediademo.ui.activity import android.content.Intent import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import android.view.View import android.widget.AdapterView import android.widget.ListView diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/AspectRatioFrameLayout.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/AspectRatioFrameLayout.kt index a5ecde1d..317c7fbd 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/AspectRatioFrameLayout.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/AspectRatioFrameLayout.kt @@ -16,7 +16,7 @@ package com.devbrackets.android.exomediademo.ui.subtitle import android.content.Context -import android.support.annotation.IntDef +import androidx.annotation.IntDef import android.util.AttributeSet import android.view.View import android.widget.FrameLayout diff --git a/demo/src/main/res/layout/audio_player_activity.xml b/demo/src/main/res/layout/audio_player_activity.xml index 18c28a94..f0b36662 100644 --- a/demo/src/main/res/layout/audio_player_activity.xml +++ b/demo/src/main/res/layout/audio_player_activity.xml @@ -76,7 +76,7 @@ android:gravity="center_horizontal" android:orientation="horizontal"> - @@ -93,7 +93,7 @@ tools:ignore="ContentDescription" tools:visibility="visible"/> - @@ -106,7 +106,7 @@ app:srcCompat="@drawable/playlistcore_ic_play_arrow_black" tools:ignore="ContentDescription"/> - @@ -122,7 +122,7 @@ tools:ignore="ContentDescription" tools:visibility="visible"/> - diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..5465fec0 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5028f28f..1b16c34a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/library/build.gradle b/library/build.gradle index 8b5c1d43..29c07941 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -20,8 +20,8 @@ static def getLibraryInfo() { } dependencies { - implementation "com.android.support:support-media-compat:$rootProject.ext.supportLibVersion" - implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibVersion" + implementation 'androidx.media:media:1.0.0' + implementation 'androidx.appcompat:appcompat:1.0.0' // ExoPlayer api "com.google.android.exoplayer:exoplayer-core:$rootProject.ext.exoPlayerVersion" diff --git a/library/src/main/java/com/devbrackets/android/exomedia/AudioPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/AudioPlayer.java index 2940d09f..f228753c 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/AudioPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/AudioPlayer.java @@ -19,9 +19,9 @@ import android.content.Context; import android.media.AudioManager; import android.net.Uri; -import android.support.annotation.FloatRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.devbrackets.android.exomedia.core.ListenerMux; import com.devbrackets.android.exomedia.core.api.AudioPlayerApi; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ExoMedia.java b/library/src/main/java/com/devbrackets/android/exomedia/ExoMedia.java index 7c58911b..ad48b916 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ExoMedia.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ExoMedia.java @@ -17,8 +17,8 @@ package com.devbrackets.android.exomedia; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.devbrackets.android.exomedia.core.source.MediaSourceProvider; import com.devbrackets.android.exomedia.core.source.builder.DashMediaSourceBuilder; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/ListenerMux.java b/library/src/main/java/com/devbrackets/android/exomedia/core/ListenerMux.java index 7351b8eb..be6be72e 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/ListenerMux.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/ListenerMux.java @@ -18,9 +18,9 @@ import android.media.MediaPlayer; import android.os.Handler; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.Surface; import com.devbrackets.android.exomedia.core.exception.NativeMediaPlaybackException; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/api/AudioPlayerApi.java b/library/src/main/java/com/devbrackets/android/exomedia/core/api/AudioPlayerApi.java index b7321928..759c2dca 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/api/AudioPlayerApi.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/api/AudioPlayerApi.java @@ -19,10 +19,10 @@ import android.content.Context; import android.media.AudioManager; import android.net.Uri; -import android.support.annotation.FloatRange; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.devbrackets.android.exomedia.ExoMedia; import com.devbrackets.android.exomedia.core.ListenerMux; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/api/VideoViewApi.java b/library/src/main/java/com/devbrackets/android/exomedia/core/api/VideoViewApi.java index 99daf46a..34c234af 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/api/VideoViewApi.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/api/VideoViewApi.java @@ -17,10 +17,10 @@ package com.devbrackets.android.exomedia.core.api; import android.net.Uri; -import android.support.annotation.FloatRange; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.View; import com.devbrackets.android.exomedia.ExoMedia; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/audio/ExoAudioPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/core/audio/ExoAudioPlayer.java index df0ff9e9..11bbb3ae 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/audio/ExoAudioPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/audio/ExoAudioPlayer.java @@ -20,10 +20,10 @@ import android.content.Context; import android.net.Uri; import android.os.Build; -import android.support.annotation.FloatRange; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.devbrackets.android.exomedia.ExoMedia; import com.devbrackets.android.exomedia.core.ListenerMux; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/audio/NativeAudioPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/core/audio/NativeAudioPlayer.java index 1183d61a..4380e7eb 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/audio/NativeAudioPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/audio/NativeAudioPlayer.java @@ -21,10 +21,10 @@ import android.media.PlaybackParams; import android.net.Uri; import android.os.Build; -import android.support.annotation.FloatRange; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.Log; import com.devbrackets.android.exomedia.ExoMedia; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java index fd11372d..5911e2e2 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java @@ -24,11 +24,11 @@ import android.os.Build; import android.os.Handler; import android.os.PowerManager; -import android.support.annotation.FloatRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.Size; -import android.support.v4.util.ArrayMap; +import androidx.annotation.FloatRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.Size; +import androidx.collection.ArrayMap; import android.util.Log; import android.view.Surface; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/WindowInfo.java b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/WindowInfo.java index 6ec4fac0..7c8b82e9 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/WindowInfo.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/WindowInfo.java @@ -16,7 +16,7 @@ package com.devbrackets.android.exomedia.core.exoplayer; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.google.android.exoplayer2.Timeline; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/RendererProvider.java b/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/RendererProvider.java index 63e29e44..522a9538 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/RendererProvider.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/RendererProvider.java @@ -18,8 +18,8 @@ import android.content.Context; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.devbrackets.android.exomedia.ExoMedia; import com.google.android.exoplayer2.Renderer; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/source/MediaSourceProvider.java b/library/src/main/java/com/devbrackets/android/exomedia/core/source/MediaSourceProvider.java index d3c5c1d8..18a1359b 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/source/MediaSourceProvider.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/source/MediaSourceProvider.java @@ -21,8 +21,8 @@ import android.net.Uri; import android.os.Build; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.devbrackets.android.exomedia.BuildConfig; import com.devbrackets.android.exomedia.ExoMedia; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DashMediaSourceBuilder.java b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DashMediaSourceBuilder.java index 85c25ef3..699da1e1 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DashMediaSourceBuilder.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DashMediaSourceBuilder.java @@ -19,8 +19,8 @@ import android.content.Context; import android.net.Uri; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.dash.DashMediaSource; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DefaultMediaSourceBuilder.java b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DefaultMediaSourceBuilder.java index 7ae9e67a..690bc043 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DefaultMediaSourceBuilder.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/DefaultMediaSourceBuilder.java @@ -19,8 +19,8 @@ import android.content.Context; import android.net.Uri; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory; import com.google.android.exoplayer2.source.MediaSource; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/HlsMediaSourceBuilder.java b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/HlsMediaSourceBuilder.java index 4342611d..6b6cd5df 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/HlsMediaSourceBuilder.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/HlsMediaSourceBuilder.java @@ -19,8 +19,8 @@ import android.content.Context; import android.net.Uri; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.hls.HlsMediaSource; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/MediaSourceBuilder.java b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/MediaSourceBuilder.java index 93f05a30..cb138026 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/MediaSourceBuilder.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/MediaSourceBuilder.java @@ -19,8 +19,8 @@ import android.content.Context; import android.net.Uri; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.devbrackets.android.exomedia.ExoMedia; import com.google.android.exoplayer2.source.MediaSource; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/SsMediaSourceBuilder.java b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/SsMediaSourceBuilder.java index 28393979..23627c3d 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/SsMediaSourceBuilder.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/SsMediaSourceBuilder.java @@ -19,8 +19,8 @@ import android.content.Context; import android.net.Uri; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/ResizingSurfaceView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/ResizingSurfaceView.java index 704c296d..6dc50a98 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/ResizingSurfaceView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/ResizingSurfaceView.java @@ -22,9 +22,9 @@ import android.content.res.Configuration; import android.graphics.Point; import android.os.Build; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.util.Log; import android.view.SurfaceView; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/ResizingTextureView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/ResizingTextureView.java index 7b44ec00..7ced25be 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/ResizingTextureView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/ResizingTextureView.java @@ -23,9 +23,9 @@ import android.graphics.Point; import android.graphics.SurfaceTexture; import android.os.Build; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.util.Log; import android.view.TextureView; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoSurfaceVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoSurfaceVideoView.java index ed10105a..84f89576 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoSurfaceVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoSurfaceVideoView.java @@ -20,10 +20,10 @@ import android.content.Context; import android.net.Uri; import android.os.Build; -import android.support.annotation.FloatRange; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.SurfaceHolder; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoTextureVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoTextureVideoView.java index 6fa676cc..86828c71 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoTextureVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoTextureVideoView.java @@ -21,10 +21,10 @@ import android.graphics.SurfaceTexture; import android.net.Uri; import android.os.Build; -import android.support.annotation.FloatRange; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.Surface; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoVideoDelegate.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoVideoDelegate.java index f756aa30..5005688b 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoVideoDelegate.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoVideoDelegate.java @@ -18,10 +18,10 @@ import android.content.Context; import android.net.Uri; -import android.support.annotation.FloatRange; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.Surface; import com.devbrackets.android.exomedia.ExoMedia; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeSurfaceVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeSurfaceVideoView.java index 72eaf170..a5baf49c 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeSurfaceVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeSurfaceVideoView.java @@ -21,9 +21,9 @@ import android.media.MediaPlayer; import android.net.Uri; import android.os.Build; -import android.support.annotation.FloatRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.SurfaceHolder; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeTextureVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeTextureVideoView.java index 6d5cfdbb..a53aa699 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeTextureVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeTextureVideoView.java @@ -22,9 +22,9 @@ import android.media.MediaPlayer; import android.net.Uri; import android.os.Build; -import android.support.annotation.FloatRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.Surface; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeVideoDelegate.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeVideoDelegate.java index 519a081c..943ae96b 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeVideoDelegate.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeVideoDelegate.java @@ -22,9 +22,9 @@ import android.media.PlaybackParams; import android.net.Uri; import android.os.Build; -import android.support.annotation.FloatRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.Log; import android.view.Surface; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/scale/MatrixManager.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/scale/MatrixManager.java index afc12570..4d047731 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/scale/MatrixManager.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/scale/MatrixManager.java @@ -17,9 +17,9 @@ package com.devbrackets.android.exomedia.core.video.scale; import android.graphics.Point; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.Log; import android.view.View; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/scale/ScaleType.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/scale/ScaleType.java index a4f67743..83fa462e 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/scale/ScaleType.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/scale/ScaleType.java @@ -16,7 +16,7 @@ package com.devbrackets.android.exomedia.core.video.scale; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; /** * See {@link android.widget.ImageView.ScaleType} for a description diff --git a/library/src/main/java/com/devbrackets/android/exomedia/listener/OnBufferUpdateListener.java b/library/src/main/java/com/devbrackets/android/exomedia/listener/OnBufferUpdateListener.java index 2ae9c8ee..afa9d9e4 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/listener/OnBufferUpdateListener.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/listener/OnBufferUpdateListener.java @@ -16,7 +16,7 @@ package com.devbrackets.android.exomedia.listener; -import android.support.annotation.IntRange; +import androidx.annotation.IntRange; /** * Interface definition of a callback to be invoked indicating buffering diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ui/animation/BottomViewHideShowAnimation.java b/library/src/main/java/com/devbrackets/android/exomedia/ui/animation/BottomViewHideShowAnimation.java index ef71101d..d6212db9 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ui/animation/BottomViewHideShowAnimation.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ui/animation/BottomViewHideShowAnimation.java @@ -17,8 +17,8 @@ package com.devbrackets.android.exomedia.ui.animation; import android.content.Context; -import android.support.v4.view.animation.FastOutLinearInInterpolator; -import android.support.v4.view.animation.LinearOutSlowInInterpolator; +import androidx.interpolator.view.animation.FastOutLinearInInterpolator; +import androidx.interpolator.view.animation.LinearOutSlowInInterpolator; import android.util.DisplayMetrics; import android.view.Display; import android.view.View; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ui/animation/TopViewHideShowAnimation.java b/library/src/main/java/com/devbrackets/android/exomedia/ui/animation/TopViewHideShowAnimation.java index 3d1b620e..3065dbe1 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ui/animation/TopViewHideShowAnimation.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ui/animation/TopViewHideShowAnimation.java @@ -16,8 +16,8 @@ package com.devbrackets.android.exomedia.ui.animation; -import android.support.v4.view.animation.FastOutLinearInInterpolator; -import android.support.v4.view.animation.LinearOutSlowInInterpolator; +import androidx.interpolator.view.animation.FastOutLinearInInterpolator; +import androidx.interpolator.view.animation.LinearOutSlowInInterpolator; import android.view.View; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/FitsSystemWindowRelativeLayout.java b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/FitsSystemWindowRelativeLayout.java index 457e765a..795e254c 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/FitsSystemWindowRelativeLayout.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/FitsSystemWindowRelativeLayout.java @@ -21,7 +21,7 @@ import android.content.res.Configuration; import android.graphics.Rect; import android.os.Build; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.AttributeSet; import android.view.WindowInsets; import android.widget.RelativeLayout; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControls.java b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControls.java index aa5cfa5f..e6759f3e 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControls.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControls.java @@ -21,11 +21,11 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; -import android.support.annotation.ColorRes; -import android.support.annotation.IntRange; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.ColorRes; +import androidx.annotation.IntRange; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.util.SparseBooleanArray; import android.view.View; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsCore.java b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsCore.java index 9379180b..6d628789 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsCore.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsCore.java @@ -16,8 +16,8 @@ package com.devbrackets.android.exomedia.ui.widget; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; /** * An Interface that represents the core VideoControl functionality that diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsLeanback.java b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsLeanback.java index ad3f20ed..c7ab928a 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsLeanback.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsLeanback.java @@ -20,7 +20,7 @@ import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.IntRange; +import androidx.annotation.IntRange; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.View; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsMobile.java b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsMobile.java index e7f05013..09262456 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsMobile.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoControlsMobile.java @@ -19,8 +19,8 @@ import android.annotation.TargetApi; import android.content.Context; import android.os.Build; -import android.support.annotation.IntRange; -import android.support.annotation.NonNull; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoView.java index 72266c42..e30402ff 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoView.java @@ -26,12 +26,12 @@ import android.media.AudioManager; import android.net.Uri; import android.os.Build; -import android.support.annotation.DrawableRes; -import android.support.annotation.FloatRange; -import android.support.annotation.IntRange; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.DrawableRes; +import androidx.annotation.FloatRange; +import androidx.annotation.IntRange; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.GestureDetector; import android.view.MotionEvent; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/util/DeviceUtil.java b/library/src/main/java/com/devbrackets/android/exomedia/util/DeviceUtil.java index cc47da20..c4504750 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/util/DeviceUtil.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/util/DeviceUtil.java @@ -20,7 +20,7 @@ import android.content.Context; import android.content.res.Configuration; import android.os.Build; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import java.util.LinkedList; import java.util.List; diff --git a/library/src/main/java/com/devbrackets/android/exomedia/util/MediaSourceUtil.java b/library/src/main/java/com/devbrackets/android/exomedia/util/MediaSourceUtil.java index 1d940a71..6a79b146 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/util/MediaSourceUtil.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/util/MediaSourceUtil.java @@ -17,8 +17,8 @@ package com.devbrackets.android.exomedia.util; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; /** * A utility to handle the checks and comparisons when determining diff --git a/library/src/main/java/com/devbrackets/android/exomedia/util/Repeater.java b/library/src/main/java/com/devbrackets/android/exomedia/util/Repeater.java index 00ccc045..b8c3f649 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/util/Repeater.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/util/Repeater.java @@ -18,7 +18,7 @@ import android.os.Handler; import android.os.HandlerThread; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; /** * A method repeater to easily perform update functions on a timed basis. diff --git a/library/src/main/java/com/devbrackets/android/exomedia/util/ResourceUtil.java b/library/src/main/java/com/devbrackets/android/exomedia/util/ResourceUtil.java index 0f341f46..955c1be3 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/util/ResourceUtil.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/util/ResourceUtil.java @@ -21,13 +21,13 @@ import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.AnyRes; -import android.support.annotation.AttrRes; -import android.support.annotation.ColorInt; -import android.support.annotation.ColorRes; -import android.support.annotation.DrawableRes; -import android.support.v4.graphics.drawable.DrawableCompat; -import android.support.v7.widget.AppCompatDrawableManager; +import androidx.annotation.AnyRes; +import androidx.annotation.AttrRes; +import androidx.annotation.ColorInt; +import androidx.annotation.ColorRes; +import androidx.annotation.DrawableRes; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.appcompat.widget.AppCompatDrawableManager; import android.util.TypedValue; /** diff --git a/library/src/main/java/com/devbrackets/android/exomedia/util/StopWatch.java b/library/src/main/java/com/devbrackets/android/exomedia/util/StopWatch.java index a417e19f..ecfe75e5 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/util/StopWatch.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/util/StopWatch.java @@ -19,8 +19,8 @@ import android.os.Handler; import android.os.HandlerThread; -import android.support.annotation.FloatRange; -import android.support.annotation.Nullable; +import androidx.annotation.FloatRange; +import androidx.annotation.Nullable; /** * A simple stopwatch to keep a correct and updated record of the running duration From a61ee731e6dbff016d734aac87edd1a0a91d16fc Mon Sep 17 00:00:00 2001 From: dgelormini Date: Mon, 6 Dec 2021 16:20:53 -0500 Subject: [PATCH 09/11] Bump exoplayer to 2.16.1, fix most issues, left some TODOs --- build.gradle | 2 +- demo/build.gradle | 9 +- .../devbrackets/android/exomediademo/App.kt | 22 +++- .../android/exomediademo/data/Samples.kt | 8 +- .../service/MediaImageProvider.kt | 2 +- .../ui/subtitle/SubtitlePainter.kt | 4 +- .../exomediademo/ui/subtitle/SubtitleView.kt | 2 +- library/build.gradle | 6 +- .../android/exomedia/core/ListenerMux.java | 46 ++----- .../core/exoplayer/ExoMediaPlayer.java | 121 +++++++++++------- .../core/renderer/RendererProvider.java | 16 ++- .../source/builder/MediaSourceBuilder.java | 5 +- 12 files changed, 139 insertions(+), 104 deletions(-) diff --git a/build.gradle b/build.gradle index 3d9b4889..ec53f13a 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,6 @@ allprojects { } ext { - exoPlayerVersion = "2.10.3" + exoPlayerVersion = "2.16.1" supportLibVersion = "28.0.0" } diff --git a/demo/build.gradle b/demo/build.gradle index 81245d56..d4c33d31 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlinVersion = '1.3.72' + ext.kotlinVersion = '1.5.31' repositories { google() jcenter() @@ -21,6 +21,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.media:media:1.0.0' implementation "com.google.android.exoplayer:extension-okhttp:$rootProject.ext.exoPlayerVersion" + implementation "com.google.android.exoplayer:exoplayer-ui:$rootProject.ext.exoPlayerVersion" // Image Loading implementation 'com.github.bumptech.glide:glide:4.6.1' @@ -34,12 +35,12 @@ dependencies { } android { - compileSdkVersion 28 + compileSdkVersion 31 defaultConfig { applicationId "com.devbrackets.android.exomediademo" - minSdkVersion 16 - targetSdkVersion 28 + minSdkVersion 21 + targetSdkVersion 31 versionCode 1 versionName "1.0.0" } diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt index 5a767f29..599c566e 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt @@ -9,7 +9,7 @@ import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSourceFactory import com.google.android.exoplayer2.upstream.DataSource import com.google.android.exoplayer2.upstream.TransferListener import com.google.android.exoplayer2.upstream.cache.CacheDataSource -import com.google.android.exoplayer2.upstream.cache.CacheDataSourceFactory +import com.google.android.exoplayer2.upstream.cache.CacheDataSource.Factory import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor import com.google.android.exoplayer2.upstream.cache.SimpleCache import com.squareup.leakcanary.LeakCanary @@ -32,16 +32,26 @@ class App : Application() { // Registers the media sources to use the OkHttp client instead of the standard Apache one // Note: the OkHttpDataSourceFactory can be found in the ExoPlayer extension library `extension-okhttp` ExoMedia.setDataSourceFactoryProvider(object : ExoMedia.DataSourceFactoryProvider { - private var instance: CacheDataSourceFactory? = null + private var instance: CacheDataSource.Factory? = null - override fun provide(userAgent: String, listener: TransferListener?): DataSource.Factory { + override fun provide( + userAgent: String, + listener: TransferListener? + ): DataSource.Factory { if (instance == null) { // Updates the network data source to use the OKHttp implementation - val upstreamFactory = OkHttpDataSourceFactory(OkHttpClient(), userAgent, listener) + val upstreamFactory = + OkHttpDataSourceFactory(OkHttpClient(), userAgent, listener) // Adds a cache around the upstreamFactory - val cache = SimpleCache(File(cacheDir, "ExoMediaCache"), LeastRecentlyUsedCacheEvictor((50 * 1024 * 1024).toLong()), databaseProvider) - instance = CacheDataSourceFactory(cache, upstreamFactory, CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR) + val cache = SimpleCache( + File(cacheDir, "ExoMediaCache"), + LeastRecentlyUsedCacheEvictor((50 * 1024 * 1024).toLong()), + databaseProvider + ) + instance = CacheDataSource.Factory().setCache(cache) + .setUpstreamDataSourceFactory(upstreamFactory) + .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR) } return instance!! diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/data/Samples.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/data/Samples.kt index 5a97ec4f..56336653 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/data/Samples.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/data/Samples.kt @@ -20,16 +20,16 @@ object Samples { //Video items videoSamples = ArrayList() videoSamples.add(Sample("FLV - Big Buck Bunny by Blender", "https://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0")) - videoSamples.add(Sample("HLS - ArtBeats", "http://cdn-fms.rbs.com.br/vod/hls_sample1_manifest.m3u8")) + videoSamples.add(Sample("HLS - ArtBeats", "https://cdn-fms.rbs.com.br/vod/hls_sample1_manifest.m3u8")) videoSamples.add(Sample("HLS - Sintel by Blender", "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8")) videoSamples.add(Sample("MKV - Android Screens", "https://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv")) - videoSamples.add(Sample("MP4 (VP9) - Google Glass", "http://demos.webmproject.org/exoplayer/glass.mp4")) + videoSamples.add(Sample("MP4 (VP9) - Google Glass", "https://demos.webmproject.org/exoplayer/glass.mp4")) videoSamples.add(Sample("MPEG DASH - Sintel by Blender", "https://bitdash-a.akamaihd.net/content/sintel/sintel.mpd")) videoSamples.add(Sample("MPEG DASH - Big Buck Bunny by Blender, Live", "https://wowzaec2demo.streamlock.net/live/bigbuckbunny/manifest_mpm4sav_mvtime.mpd")) videoSamples.add(Sample("Smooth Stream - Caminandes: Llama Drama by Blender", "https://amssamples.streaming.mediaservices.windows.net/634cd01c-6822-4630-8444-8dd6279f94c6/CaminandesLlamaDrama4K.ism/manifest")) videoSamples.add(Sample("Smooth Stream - Tears of Steel Teaser by Blender", "https://amssamples.streaming.mediaservices.windows.net/3d7eaff9-39fa-442f-81cc-f2ea7db1797e/TearsOfSteelTeaser.ism/manifest")) - videoSamples.add(Sample("WEBM - Big Buck Bunny", "http://dl1.webmfiles.org/big-buck-bunny_trailer.webm")) - videoSamples.add(Sample("WEBM - Elephants Dream", "http://dl1.webmfiles.org/elephants-dream.webm")) + videoSamples.add(Sample("WEBM - Big Buck Bunny", "https://dl1.webmfiles.org/big-buck-bunny_trailer.webm")) + videoSamples.add(Sample("WEBM - Elephants Dream", "https://dl1.webmfiles.org/elephants-dream.webm")) } fun getAudioSamples(): List { diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/service/MediaImageProvider.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/service/MediaImageProvider.kt index a6ed3890..4ef9154e 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/service/MediaImageProvider.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/service/MediaImageProvider.kt @@ -20,7 +20,7 @@ class MediaImageProvider(context: Context, private val onImageUpdated: () -> Uni private val notificationImageTarget = NotificationImageTarget() private val remoteViewImageTarget = RemoteViewImageTarget() - private val defaultNotificationImage: Bitmap by lazy { BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher) } + private val defaultNotificationImage: Bitmap? by lazy { BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher) } private var notificationImage: Bitmap? = null override var remoteViewArtwork: Bitmap? = null diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/SubtitlePainter.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/SubtitlePainter.kt index 5753ddf0..5df6a42e 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/SubtitlePainter.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/SubtitlePainter.kt @@ -35,8 +35,8 @@ import android.text.style.AbsoluteSizeSpan import android.text.style.RelativeSizeSpan import android.util.DisplayMetrics import android.util.Log -import com.google.android.exoplayer2.text.CaptionStyleCompat import com.google.android.exoplayer2.text.Cue +import com.google.android.exoplayer2.ui.CaptionStyleCompat import com.google.android.exoplayer2.util.Util /** @@ -482,7 +482,7 @@ internal class SubtitlePainter(context: Context) { * latter only checks the text of each sequence, and does not check for equality of styling that * may be embedded within the [CharSequence]s. */ - private fun areCharSequencesEqual(first: CharSequence?, second: CharSequence): Boolean { + private fun areCharSequencesEqual(first: CharSequence?, second: CharSequence?): Boolean { // Some CharSequence implementations don't perform a cheap referential equality check in their // equals methods, so we perform one explicitly here. @Suppress("SuspiciousEqualsCombination") diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/SubtitleView.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/SubtitleView.kt index 311cf306..33acab19 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/SubtitleView.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/ui/subtitle/SubtitleView.kt @@ -23,7 +23,7 @@ import android.util.TypedValue import android.view.View import android.view.accessibility.CaptioningManager import com.devbrackets.android.exomedia.core.listener.CaptionListener -import com.google.android.exoplayer2.text.CaptionStyleCompat +import com.google.android.exoplayer2.ui.CaptionStyleCompat import com.google.android.exoplayer2.text.Cue @Suppress("MemberVisibilityCanBePrivate", "unused") diff --git a/library/build.gradle b/library/build.gradle index 29c07941..b57d0f08 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -7,7 +7,7 @@ apply plugin: 'com.android.library' class LibraryInfo { static Integer versionMajor = 4 static Integer versionMinor = 3 - static Integer versionPatch = 0 + static Integer versionPatch = 1 static String artifactId = 'exomedia' static String groupId = 'com.devbrackets.android' @@ -31,11 +31,11 @@ dependencies { } android { - compileSdkVersion 28 + compileSdkVersion 31 defaultConfig { minSdkVersion 14 - targetSdkVersion 28 + targetSdkVersion 31 versionCode getLibraryInfo().versionCode versionName getLibraryInfo().versionName diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/ListenerMux.java b/library/src/main/java/com/devbrackets/android/exomedia/core/ListenerMux.java index be6be72e..18ccd09c 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/ListenerMux.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/ListenerMux.java @@ -35,12 +35,15 @@ import com.devbrackets.android.exomedia.listener.OnSeekCompletionListener; import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.Format; +import com.google.android.exoplayer2.PlaybackException; import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.analytics.AnalyticsListener; import com.google.android.exoplayer2.audio.AudioAttributes; import com.google.android.exoplayer2.decoder.DecoderCounters; import com.google.android.exoplayer2.metadata.Metadata; +import com.google.android.exoplayer2.source.LoadEventInfo; +import com.google.android.exoplayer2.source.MediaLoadData; import com.google.android.exoplayer2.source.MediaSourceEventListener; import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.android.exoplayer2.trackselection.TrackSelectionArray; @@ -248,7 +251,7 @@ public void onLoadingChanged(EventTime eventTime, boolean isLoading) { } @Override - public void onPlayerError(EventTime eventTime, ExoPlaybackException error) { + public void onPlayerError(EventTime eventTime, PlaybackException error) { if (analyticsListener != null) { analyticsListener.onPlayerError(eventTime, error); } @@ -262,68 +265,47 @@ public void onTracksChanged(EventTime eventTime, TrackGroupArray trackGroups, Tr } @Override - public void onLoadStarted(EventTime eventTime, MediaSourceEventListener.LoadEventInfo loadEventInfo, MediaSourceEventListener.MediaLoadData mediaLoadData) { + public void onLoadStarted(EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) { if (analyticsListener != null) { analyticsListener.onLoadStarted(eventTime, loadEventInfo, mediaLoadData); } } @Override - public void onLoadCompleted(EventTime eventTime, MediaSourceEventListener.LoadEventInfo loadEventInfo, MediaSourceEventListener.MediaLoadData mediaLoadData) { + public void onLoadCompleted(EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) { if (analyticsListener != null) { analyticsListener.onLoadCompleted(eventTime, loadEventInfo, mediaLoadData); } } @Override - public void onLoadCanceled(EventTime eventTime, MediaSourceEventListener.LoadEventInfo loadEventInfo, MediaSourceEventListener.MediaLoadData mediaLoadData) { + public void onLoadCanceled(EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) { if (analyticsListener != null) { analyticsListener.onLoadCanceled(eventTime, loadEventInfo, mediaLoadData); } } @Override - public void onLoadError(EventTime eventTime, MediaSourceEventListener.LoadEventInfo loadEventInfo, MediaSourceEventListener.MediaLoadData mediaLoadData, IOException error, boolean wasCanceled) { + public void onLoadError(EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, IOException error, boolean wasCanceled) { if (analyticsListener != null) { analyticsListener.onLoadError(eventTime, loadEventInfo, mediaLoadData, error, wasCanceled); } } @Override - public void onDownstreamFormatChanged(EventTime eventTime, MediaSourceEventListener.MediaLoadData mediaLoadData) { + public void onDownstreamFormatChanged(EventTime eventTime, MediaLoadData mediaLoadData) { if (analyticsListener != null) { analyticsListener.onDownstreamFormatChanged(eventTime, mediaLoadData); } } @Override - public void onUpstreamDiscarded(EventTime eventTime, MediaSourceEventListener.MediaLoadData mediaLoadData) { + public void onUpstreamDiscarded(EventTime eventTime, MediaLoadData mediaLoadData) { if (analyticsListener != null) { analyticsListener.onUpstreamDiscarded(eventTime, mediaLoadData); } } - @Override - public void onMediaPeriodCreated(EventTime eventTime) { - if (analyticsListener != null) { - analyticsListener.onMediaPeriodCreated(eventTime); - } - } - - @Override - public void onMediaPeriodReleased(EventTime eventTime) { - if (analyticsListener != null) { - analyticsListener.onMediaPeriodReleased(eventTime); - } - } - - @Override - public void onReadingStarted(EventTime eventTime) { - if (analyticsListener != null) { - analyticsListener.onReadingStarted(eventTime); - } - } - @Override public void onBandwidthEstimate(EventTime eventTime, int totalLoadTimeMs, long totalBytesLoaded, long bitrateEstimate) { if (analyticsListener != null) { @@ -402,9 +384,9 @@ public void onDecoderDisabled(EventTime eventTime, int trackType, DecoderCounter } @Override - public void onAudioSessionId(EventTime eventTime, int audioSessionId) { + public void onAudioSessionIdChanged(EventTime eventTime, int audioSessionId) { if (analyticsListener != null) { - analyticsListener.onAudioSessionId(eventTime, audioSessionId); + analyticsListener.onAudioSessionIdChanged(eventTime, audioSessionId); } } @@ -430,9 +412,9 @@ public void onVideoSizeChanged(EventTime eventTime, int width, int height, int u } @Override - public void onRenderedFirstFrame(EventTime eventTime, Surface surface) { + public void onRenderedFirstFrame(EventTime eventTime, Object output, long renderTimeMs) { if (analyticsListener != null) { - analyticsListener.onRenderedFirstFrame(eventTime, surface); + analyticsListener.onRenderedFirstFrame(eventTime, output, renderTimeMs); } } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java index 5911e2e2..c4bd2b8d 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/exoplayer/ExoMediaPlayer.java @@ -23,12 +23,15 @@ import android.net.Uri; import android.os.Build; import android.os.Handler; +import android.os.Looper; import android.os.PowerManager; + import androidx.annotation.FloatRange; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.Size; import androidx.collection.ArrayMap; + import android.util.Log; import android.view.Surface; @@ -43,30 +46,34 @@ import com.devbrackets.android.exomedia.util.Repeater; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.DefaultLoadControl; +import com.google.android.exoplayer2.DefaultRenderersFactory; import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlayer; -import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.LoadControl; +import com.google.android.exoplayer2.PlaybackException; import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.PlayerMessage; import com.google.android.exoplayer2.Renderer; +import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.analytics.AnalyticsCollector; import com.google.android.exoplayer2.analytics.AnalyticsListener; import com.google.android.exoplayer2.audio.AudioAttributes; import com.google.android.exoplayer2.audio.AudioRendererEventListener; import com.google.android.exoplayer2.decoder.DecoderCounters; -import com.google.android.exoplayer2.drm.DefaultDrmSessionEventListener; import com.google.android.exoplayer2.drm.DefaultDrmSessionManager; +import com.google.android.exoplayer2.drm.DrmSessionEventListener; import com.google.android.exoplayer2.drm.DrmSessionManager; import com.google.android.exoplayer2.drm.ExoMediaDrm; -import com.google.android.exoplayer2.drm.FrameworkMediaCrypto; -import com.google.android.exoplayer2.drm.FrameworkMediaDrm; +//import com.google.android.exoplayer2.drm.FrameworkMediaCrypto; +//import com.google.android.exoplayer2.drm.FrameworkMediaDrm; import com.google.android.exoplayer2.drm.MediaDrmCallback; +import com.google.android.exoplayer2.drm.MediaDrmCallbackException; import com.google.android.exoplayer2.metadata.Metadata; import com.google.android.exoplayer2.metadata.MetadataOutput; +import com.google.android.exoplayer2.source.DefaultMediaSourceFactory; import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.TrackGroup; import com.google.android.exoplayer2.source.TrackGroupArray; @@ -80,6 +87,7 @@ import com.google.android.exoplayer2.util.Clock; import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.video.VideoRendererEventListener; +import com.google.android.exoplayer2.video.VideoSize; import java.util.ArrayList; import java.util.Collections; @@ -148,7 +156,7 @@ public class ExoMediaPlayer implements Player.EventListener { protected float requestedVolume = 1.0f; @NonNull - private AnalyticsCollector analyticsCollector; + private final AnalyticsCollector analyticsCollector = new AnalyticsCollector(Clock.DEFAULT); public ExoMediaPlayer(@NonNull Context context) { this.context = context; @@ -160,7 +168,7 @@ public ExoMediaPlayer(@NonNull Context context) { ComponentListener componentListener = new ComponentListener(); RendererProvider rendererProvider = new RendererProvider(context, mainHandler, componentListener, componentListener, componentListener, componentListener); - DrmSessionManager drmSessionManager = generateDrmSessionManager(); + DrmSessionManager drmSessionManager = generateDrmSessionManager(); rendererProvider.setDrmSessionManager(drmSessionManager); renderers = rendererProvider.generate(); @@ -170,9 +178,12 @@ public ExoMediaPlayer(@NonNull Context context) { bandwidthMeter = new DefaultBandwidthMeter.Builder(context).build(); LoadControl loadControl = ExoMedia.Data.loadControl != null ? ExoMedia.Data.loadControl : new DefaultLoadControl(); - player = ExoPlayerFactory.newInstance(context, renderers.toArray(new Renderer[renderers.size()]), trackSelector, loadControl, bandwidthMeter, Util.getLooper()); + DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(context); + //.toArray(new Renderer[renderers.size()]) +// renderersFactory.createRenderers() TODO: Figure out Renderers + player = new SimpleExoPlayer.Builder(context, renderersFactory, trackSelector, new DefaultMediaSourceFactory(context), loadControl, bandwidthMeter, analyticsCollector).build(); player.addListener(this); - analyticsCollector = new AnalyticsCollector.Factory().createAnalyticsCollector(player, Clock.DEFAULT); + analyticsCollector.setPlayer(player, Looper.getMainLooper()); // TODO: Is this the right looper to use? player.addListener(analyticsCollector); setupDamSessionManagerAnalytics(drmSessionManager); } @@ -183,7 +194,7 @@ public void onPlayerStateChanged(boolean playWhenReady, int state) { } @Override - public void onPlayerError(ExoPlaybackException exception) { + public void onPlayerError(@NonNull PlaybackException exception) { for (ExoPlayerListener listener : listeners) { listener.onError(this, exception); } @@ -208,7 +219,8 @@ public void setUri(@Nullable Uri uri) { public void setMediaSource(@Nullable MediaSource source) { if (this.mediaSource != null) { this.mediaSource.removeEventListener(analyticsCollector); - analyticsCollector.resetForNewMediaSource(); + // TODO: Is there a replacement for below? + // analyticsCollector.resetForNewMediaSource(); } if (source != null) { source.addEventListener(mainHandler, analyticsCollector); @@ -250,7 +262,7 @@ public void setMetadataListener(@Nullable MetadataListener listener) { public void setSurface(@Nullable Surface surface) { this.surface = surface; - sendMessage(C.TRACK_TYPE_VIDEO, C.MSG_SET_SURFACE, surface, false); + sendMessage(C.TRACK_TYPE_VIDEO, Renderer.MSG_SET_VIDEO_OUTPUT, surface, false); } @Nullable @@ -300,7 +312,7 @@ public void clearSurface() { } surface = null; - sendMessage(C.TRACK_TYPE_VIDEO, C.MSG_SET_SURFACE, null, false); + sendMessage(C.TRACK_TYPE_VIDEO, Renderer.MSG_SET_VIDEO_OUTPUT, null, false); } /** @@ -464,6 +476,7 @@ public void setRendererEnabled(@NonNull RendererType type, boolean enabled) { /** * Return true if at least one renderer for the given type is enabled + * * @param type The renderer type * @return true if at least one renderer for the given type is enabled */ @@ -481,7 +494,7 @@ public boolean isRendererEnabled(@NonNull RendererType type) { public void setVolume(@FloatRange(from = 0.0, to = 1.0) float volume) { requestedVolume = volume; - sendMessage(C.TRACK_TYPE_AUDIO, C.MSG_SET_VOLUME, requestedVolume); + sendMessage(C.TRACK_TYPE_AUDIO, Renderer.MSG_SET_VOLUME, requestedVolume); } @FloatRange(from = 0.0, to = 1.0) @@ -500,7 +513,7 @@ public void setAudioStreamType(int streamType) { .setContentType(contentType) .build(); - sendMessage(C.TRACK_TYPE_AUDIO, C.MSG_SET_AUDIO_ATTRIBUTES, audioAttributes); + sendMessage(C.TRACK_TYPE_AUDIO, Renderer.MSG_SET_AUDIO_ATTRIBUTES, audioAttributes); } public void forcePrepare() { @@ -687,7 +700,7 @@ public WindowInfo getWindowInfo() { } int currentWindowIndex = player.getCurrentWindowIndex(); - Timeline.Window currentWindow = timeline.getWindow(currentWindowIndex, new Timeline.Window(), true); + Timeline.Window currentWindow = timeline.getWindow(currentWindowIndex, new Timeline.Window()); return new WindowInfo( player.getPreviousWindowIndex(), @@ -900,7 +913,7 @@ protected void stayAwake(boolean awake) { * @return The {@link DrmSessionManager} to use or null */ @Nullable - protected DrmSessionManager generateDrmSessionManager() { + protected DrmSessionManager generateDrmSessionManager() { // DRM is only supported on API 18 + in the ExoPlayer if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { return null; @@ -908,22 +921,27 @@ protected DrmSessionManager generateDrmSessionManager() { // Widevine will capture the majority of use cases however playready is supported on all AndroidTV devices UUID uuid = C.WIDEVINE_UUID; - - try { - DefaultDrmSessionManager sessionManager = new DefaultDrmSessionManager<>(uuid, FrameworkMediaDrm.newInstance(uuid), new DelegatedMediaDrmCallback(), null); + // TODO: Just returning default for now; we don't use DRM anyway. + return new DefaultDrmSessionManager.Builder().build(drmCallback); + // TODO: What to do with stuff below? + /*try { + DefaultDrmSessionManager sessionManager = new DefaultDrmSessionManager.Builder() + .setUuidAndExoMediaDrmProvider(uuid, new DelegatedMediaDrmCallback()) + .setUuidAndExoMediaDrmProvider(uuid, FrameworkMediaDrm.newInstance(uuid)); sessionManager.addListener(mainHandler, capabilitiesListener); return sessionManager; } catch (Exception e) { Log.d(TAG, "Unable to create a DrmSessionManager due to an exception", e); return null; - } + }*/ } - protected void setupDamSessionManagerAnalytics(DrmSessionManager drmSessionManager) { - if (drmSessionManager instanceof DefaultDrmSessionManager) { + protected void setupDamSessionManagerAnalytics(DrmSessionManager drmSessionManager) { + // TODO: Not sure what the replacement is for this either. We don't use DRM anyway. + /*if (drmSessionManager instanceof DefaultDrmSessionManager) { ((DefaultDrmSessionManager) drmSessionManager).addListener(mainHandler, analyticsCollector); - } + }*/ } private void reportPlayerState() { @@ -1031,37 +1049,47 @@ public void onRepeat() { */ private class DelegatedMediaDrmCallback implements MediaDrmCallback { @Override - public byte[] executeProvisionRequest(UUID uuid, ExoMediaDrm.ProvisionRequest request) throws Exception { + public byte[] executeProvisionRequest(UUID uuid, ExoMediaDrm.ProvisionRequest request) throws MediaDrmCallbackException { return drmCallback != null ? drmCallback.executeProvisionRequest(uuid, request) : new byte[0]; } @Override - public byte[] executeKeyRequest(UUID uuid, ExoMediaDrm.KeyRequest request) throws Exception { + public byte[] executeKeyRequest(UUID uuid, ExoMediaDrm.KeyRequest request) throws MediaDrmCallbackException { return drmCallback != null ? drmCallback.executeKeyRequest(uuid, request) : new byte[0]; } } - private class CapabilitiesListener implements DefaultDrmSessionEventListener { + private class CapabilitiesListener implements DrmSessionEventListener { @Override - public void onDrmKeysLoaded() { + public void onDrmSessionAcquired(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, int state) { // Purposefully left blank } @Override - public void onDrmKeysRestored() { + public void onDrmKeysLoaded(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId) { // Purposefully left blank } @Override - public void onDrmKeysRemoved() { + public void onDrmSessionManagerError(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, Exception error) { + if (internalErrorListener != null) { + internalErrorListener.onDrmSessionManagerError(error); + } + } + + @Override + public void onDrmKeysRestored(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId) { // Purposefully left blank } @Override - public void onDrmSessionManagerError(Exception e) { - if (internalErrorListener != null) { - internalErrorListener.onDrmSessionManagerError(e); - } + public void onDrmKeysRemoved(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId) { + // Purposefully left blank + } + + @Override + public void onDrmSessionReleased(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId) { + // Purposefully left blank } } @@ -1082,11 +1110,13 @@ public void onAudioDisabled(DecoderCounters counters) { analyticsCollector.onAudioDisabled(counters); } + /* + // TODO: Replacement for this? @Override - public void onAudioSessionId(int sessionId) { + public void onAudioSessionIdChanged(int sessionId) { audioSessionId = sessionId; - analyticsCollector.onAudioSessionId(sessionId); - } + analyticsCollector.onAudioSessionIdChanged(sessionId); + }*/ @Override public void onAudioDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) { @@ -1099,11 +1129,11 @@ public void onAudioInputFormatChanged(Format format) { } @Override - public void onAudioSinkUnderrun(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs) { + public void onAudioUnderrun(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs) { if (internalErrorListener != null) { internalErrorListener.onAudioSinkUnderrun(bufferSize, bufferSizeMs, elapsedSinceLastFeedMs); } - analyticsCollector.onAudioSinkUnderrun(bufferSize, bufferSizeMs, elapsedSinceLastFeedMs); + analyticsCollector.onAudioUnderrun(bufferSize, bufferSizeMs, elapsedSinceLastFeedMs); } @Override @@ -1132,16 +1162,21 @@ public void onDroppedFrames(int count, long elapsedMs) { } @Override - public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) { + public void onVideoSizeChanged(VideoSize videoSize) { for (ExoPlayerListener listener : listeners) { - listener.onVideoSizeChanged(width, height, unappliedRotationDegrees, pixelWidthHeightRatio); + listener.onVideoSizeChanged(videoSize.width, videoSize.height, videoSize.unappliedRotationDegrees, videoSize.pixelWidthHeightRatio); } - analyticsCollector.onVideoSizeChanged(width, height, unappliedRotationDegrees, pixelWidthHeightRatio); + analyticsCollector.onVideoSizeChanged(videoSize); } + /*@Override + public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) { + + }*/ + @Override - public void onRenderedFirstFrame(Surface surface) { - analyticsCollector.onRenderedFirstFrame(surface); + public void onRenderedFirstFrame(Object output, long renderTimeMs) { + analyticsCollector.onRenderedFirstFrame(output, renderTimeMs); } @Override diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/RendererProvider.java b/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/RendererProvider.java index 522a9538..74089a86 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/RendererProvider.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/RendererProvider.java @@ -27,7 +27,6 @@ import com.google.android.exoplayer2.audio.AudioRendererEventListener; import com.google.android.exoplayer2.audio.MediaCodecAudioRenderer; import com.google.android.exoplayer2.drm.DrmSessionManager; -import com.google.android.exoplayer2.drm.FrameworkMediaCrypto; import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; import com.google.android.exoplayer2.metadata.MetadataDecoderFactory; import com.google.android.exoplayer2.metadata.MetadataOutput; @@ -61,7 +60,7 @@ public class RendererProvider { protected VideoRendererEventListener videoRendererEventListener; @Nullable - protected DrmSessionManager drmSessionManager; + protected DrmSessionManager drmSessionManager; protected int droppedFrameNotificationAmount = 50; protected int videoJoiningTimeMs = 5_000; @@ -75,7 +74,7 @@ public RendererProvider(@NonNull Context context, @NonNull Handler handler, @Non this.videoRendererEventListener = videoRendererEventListener; } - public void setDrmSessionManager(@Nullable DrmSessionManager drmSessionManager) { + public void setDrmSessionManager(@Nullable DrmSessionManager drmSessionManager) { this.drmSessionManager = drmSessionManager; } @@ -99,10 +98,17 @@ public List generate() { return renderers; } +/* public class RendererFactory extends RenderersFactory { + + @Override + public Renderer[] createRenderers(Handler eventHandler, VideoRendererEventListener videoRendererEventListener, AudioRendererEventListener audioRendererEventListener, TextOutput textRendererOutput, MetadataOutput metadataRendererOutput) { + return new Renderer[0]; + } + }*/ @NonNull protected List buildAudioRenderers() { List renderers = new ArrayList<>(); - renderers.add(new MediaCodecAudioRenderer(context, MediaCodecSelector.DEFAULT, drmSessionManager, true, handler, audioRendererEventListener, AudioCapabilities.getCapabilities(context))); + renderers.add(new MediaCodecAudioRenderer(context, MediaCodecSelector.DEFAULT, handler, audioRendererEventListener/*, drmSessionManager,*/, AudioCapabilities.getCapabilities(context))); // Adds any registered classes List classNames = ExoMedia.Data.registeredRendererClasses.get(ExoMedia.RendererType.AUDIO); @@ -126,7 +132,7 @@ protected List buildAudioRenderers() { protected List buildVideoRenderers() { List renderers = new ArrayList<>(); - renderers.add(new MediaCodecVideoRenderer(context, MediaCodecSelector.DEFAULT, videoJoiningTimeMs, drmSessionManager, false, handler, videoRendererEventListener, droppedFrameNotificationAmount)); + renderers.add(new MediaCodecVideoRenderer(context, MediaCodecSelector.DEFAULT, videoJoiningTimeMs, false, handler, videoRendererEventListener, droppedFrameNotificationAmount)); // Adds any registered classes List classNames = ExoMedia.Data.registeredRendererClasses.get(ExoMedia.RendererType.VIDEO); diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/MediaSourceBuilder.java b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/MediaSourceBuilder.java index cb138026..e0e92e82 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/MediaSourceBuilder.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/source/builder/MediaSourceBuilder.java @@ -19,6 +19,7 @@ import android.content.Context; import android.net.Uri; import android.os.Handler; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -26,7 +27,7 @@ import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; -import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; +import com.google.android.exoplayer2.upstream.DefaultHttpDataSource; import com.google.android.exoplayer2.upstream.TransferListener; public abstract class MediaSourceBuilder { @@ -47,7 +48,7 @@ protected DataSource.Factory buildDataSourceFactory(@NonNull Context context, @N // If no factory was provided use the default one if (dataSourceFactory == null) { - dataSourceFactory = new DefaultHttpDataSourceFactory(userAgent, listener); + dataSourceFactory = new DefaultHttpDataSource.Factory().setUserAgent(userAgent).setTransferListener(listener); } return new DefaultDataSourceFactory(context, listener, dataSourceFactory); From 3c72d54a266f18c675e2e3a855dbf6fd1af94a17 Mon Sep 17 00:00:00 2001 From: dgelormini Date: Tue, 7 Dec 2021 21:47:19 -0500 Subject: [PATCH 10/11] Update dependencies --- build.gradle | 4 +-- demo/build.gradle | 10 +++--- demo/src/main/AndroidManifest.xml | 18 ++++++---- .../devbrackets/android/exomediademo/App.kt | 2 -- gradle/wrapper/gradle-wrapper.properties | 2 +- jitpack.yml | 3 ++ library/build.gradle | 9 ++--- .../core/renderer/PlayerRendererFactory.kt | 33 +++++++++++++++++++ 8 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 jitpack.yml create mode 100644 library/src/main/java/com/devbrackets/android/exomedia/core/renderer/PlayerRendererFactory.kt diff --git a/build.gradle b/build.gradle index ec53f13a..b74472c4 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.1' + classpath 'com.android.tools.build:gradle:7.0.3' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' } } @@ -17,6 +17,6 @@ allprojects { } ext { - exoPlayerVersion = "2.16.1" + exoPlayerVersion = "2.16.0" supportLibVersion = "28.0.0" } diff --git a/demo/build.gradle b/demo/build.gradle index d4c33d31..2b66ab14 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -18,20 +18,20 @@ dependencies { implementation project(':library') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" - implementation 'androidx.appcompat:appcompat:1.0.0' - implementation 'androidx.media:media:1.0.0' + implementation 'androidx.appcompat:appcompat:1.4.0' + implementation 'androidx.media:media:1.4.3' implementation "com.google.android.exoplayer:extension-okhttp:$rootProject.ext.exoPlayerVersion" implementation "com.google.android.exoplayer:exoplayer-ui:$rootProject.ext.exoPlayerVersion" // Image Loading - implementation 'com.github.bumptech.glide:glide:4.6.1' - annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1' + implementation 'com.github.bumptech.glide:glide:4.12.0' + annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' // Playlist support implementation 'com.devbrackets.android:playlistcore:2.0.1' // Memory Leak diagnostics - implementation 'com.squareup.leakcanary:leakcanary-android:1.5.4' + implementation 'com.squareup.leakcanary:leakcanary-android:2.7' } android { diff --git a/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml index c966ebc2..8b3d5556 100644 --- a/demo/src/main/AndroidManifest.xml +++ b/demo/src/main/AndroidManifest.xml @@ -15,7 +15,8 @@ android:name=".App"> + android:label="@string/app_name" + android:exported="true"> @@ -24,24 +25,29 @@ + android:label="@string/title_activity_video_player" + android:exported="false"> + android:label="@string/title_activity_video_player" + android:exported="false"> + android:label="@string/title_activity_video_player" + android:exported="false"> + android:label="@string/title_activity_audio_player" + android:exported="false"> + android:label="@string/title_activity_audio_player" + android:exported="false"> diff --git a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt index 599c566e..29572484 100644 --- a/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt +++ b/demo/src/main/kotlin/com/devbrackets/android/exomediademo/App.kt @@ -12,7 +12,6 @@ import com.google.android.exoplayer2.upstream.cache.CacheDataSource import com.google.android.exoplayer2.upstream.cache.CacheDataSource.Factory import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor import com.google.android.exoplayer2.upstream.cache.SimpleCache -import com.squareup.leakcanary.LeakCanary import okhttp3.OkHttpClient import java.io.File @@ -23,7 +22,6 @@ class App : Application() { override fun onCreate() { super.onCreate() - LeakCanary.install(this) configureExoMedia() } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1b16c34a..0f80bbf5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 00000000..614d1f26 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,3 @@ +before_install: + - sdk install java 11.0.10-open + - sdk use java 11.0.10-open diff --git a/library/build.gradle b/library/build.gradle index b57d0f08..e2ce0f2c 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -20,11 +20,12 @@ static def getLibraryInfo() { } dependencies { - implementation 'androidx.media:media:1.0.0' - implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'androidx.media:media:1.4.3' + implementation 'androidx.appcompat:appcompat:1.4.0' // ExoPlayer api "com.google.android.exoplayer:exoplayer-core:$rootProject.ext.exoPlayerVersion" + api "com.google.android.exoplayer:exoplayer-ui:$rootProject.ext.exoPlayerVersion" api "com.google.android.exoplayer:exoplayer-dash:$rootProject.ext.exoPlayerVersion" api "com.google.android.exoplayer:exoplayer-hls:$rootProject.ext.exoPlayerVersion" api "com.google.android.exoplayer:exoplayer-smoothstreaming:$rootProject.ext.exoPlayerVersion" @@ -37,8 +38,8 @@ android { minSdkVersion 14 targetSdkVersion 31 - versionCode getLibraryInfo().versionCode - versionName getLibraryInfo().versionName + buildConfigField("long", "VERSION_CODE", "${getLibraryInfo().versionCode}") + buildConfigField("String","VERSION_NAME","\"${getLibraryInfo().versionName}\"") vectorDrawables.useSupportLibrary = true } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/PlayerRendererFactory.kt b/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/PlayerRendererFactory.kt new file mode 100644 index 00000000..ca99e1b8 --- /dev/null +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/renderer/PlayerRendererFactory.kt @@ -0,0 +1,33 @@ +package com.devbrackets.android.exomedia.core.renderer + +import android.content.Context +import android.os.Handler +import com.devbrackets.android.exomedia.core.renderer.provider.AudioRenderProvider +import com.devbrackets.android.exomedia.core.renderer.provider.CaptionRenderProvider +import com.devbrackets.android.exomedia.core.renderer.provider.MetadataRenderProvider +import com.devbrackets.android.exomedia.core.renderer.provider.VideoRenderProvider +import com.google.android.exoplayer2.Renderer +import com.google.android.exoplayer2.RenderersFactory +import com.google.android.exoplayer2.audio.AudioRendererEventListener +import com.google.android.exoplayer2.metadata.MetadataOutput +import com.google.android.exoplayer2.text.TextOutput +import com.google.android.exoplayer2.video.VideoRendererEventListener + +class PlayerRendererFactory( + private val context: Context +): RenderersFactory { + override fun createRenderers( + eventHandler: Handler, + videoRendererEventListener: VideoRendererEventListener, + audioRendererEventListener: AudioRendererEventListener, + textRendererOutput: TextOutput, + metadataRendererOutput: MetadataOutput + ): Array { + return mutableListOf().apply { + addAll(AudioRenderProvider().buildRenderers(context, eventHandler, audioRendererEventListener)) + addAll(VideoRenderProvider().buildRenderers(context, eventHandler, videoRendererEventListener)) + addAll(CaptionRenderProvider().buildRenderers(eventHandler, textRendererOutput)) + addAll(MetadataRenderProvider().buildRenderers(eventHandler, metadataRendererOutput)) + }.toTypedArray() + } +} \ No newline at end of file From d8bcad5bc3589b410b5017b9aa571c2e273a18fa Mon Sep 17 00:00:00 2001 From: dgelormini Date: Tue, 7 Dec 2021 22:34:25 -0500 Subject: [PATCH 11/11] Bump to 2.16.1 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b74472c4..1937fa81 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,6 @@ allprojects { } ext { - exoPlayerVersion = "2.16.0" + exoPlayerVersion = "2.16.1" supportLibVersion = "28.0.0" }