From 5c4520ea37616897dd174ac76be58c9357d58be6 Mon Sep 17 00:00:00 2001 From: CappielloAntonio Date: Sun, 18 Apr 2021 11:00:51 +0200 Subject: [PATCH] Updated ExoPlayer to 2.13.3 --- app/build.gradle | 2 +- .../com/cappielloantonio/play/service/MultiPlayer.java | 2 ++ .../play/service/UnknownMediaSourceFactory.kt | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3729459d..d8b89902 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { implementation "com.github.woltapp:blurhash:f41a23cc50" // Exoplayer - implementation 'com.google.android.exoplayer:exoplayer:2.12.2' + implementation 'com.google.android.exoplayer:exoplayer:2.13.3' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' annotationProcessor "androidx.room:room-compiler:2.2.6" diff --git a/app/src/main/java/com/cappielloantonio/play/service/MultiPlayer.java b/app/src/main/java/com/cappielloantonio/play/service/MultiPlayer.java index da26bd06..2b00bc27 100644 --- a/app/src/main/java/com/cappielloantonio/play/service/MultiPlayer.java +++ b/app/src/main/java/com/cappielloantonio/play/service/MultiPlayer.java @@ -79,6 +79,8 @@ public class MultiPlayer implements Playback { MediaSourceFactory mediaSourceFactory = new UnknownMediaSourceFactory(buildDataSourceFactory()); exoPlayer = new SimpleExoPlayer.Builder(context).setMediaSourceFactory(mediaSourceFactory).build(); + // TODO: “Player is accessed on the wrong thread” suppressed + exoPlayer.setThrowsWhenUsingWrongThread(false); exoPlayer.addListener(eventListener); exoPlayer.prepare(); diff --git a/app/src/main/java/com/cappielloantonio/play/service/UnknownMediaSourceFactory.kt b/app/src/main/java/com/cappielloantonio/play/service/UnknownMediaSourceFactory.kt index 976d91da..7669f5dd 100644 --- a/app/src/main/java/com/cappielloantonio/play/service/UnknownMediaSourceFactory.kt +++ b/app/src/main/java/com/cappielloantonio/play/service/UnknownMediaSourceFactory.kt @@ -2,6 +2,7 @@ package com.cappielloantonio.play.service import com.google.android.exoplayer2.MediaItem import com.google.android.exoplayer2.drm.DrmSessionManager +import com.google.android.exoplayer2.drm.DrmSessionManagerProvider import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory import com.google.android.exoplayer2.source.MediaSource import com.google.android.exoplayer2.source.MediaSourceFactory @@ -19,7 +20,6 @@ class UnknownMediaSourceFactory(dataSourceFactory: DataSource.Factory) : MediaSo private val progressiveMediaSource : ProgressiveMediaSource.Factory private var loadErrorHandlingPolicy: LoadErrorHandlingPolicy - override fun setDrmSessionManager(drmSessionManager: DrmSessionManager?): MediaSourceFactory { return this } @@ -55,6 +55,10 @@ class UnknownMediaSourceFactory(dataSourceFactory: DataSource.Factory) : MediaSo return sourceFactory.createMediaSource(mediaItem) } + override fun setDrmSessionManagerProvider(drmSessionManagerProvider: DrmSessionManagerProvider?): MediaSourceFactory { + TODO("Not yet implemented") + } + private suspend fun httpGet(url: String?): String? { return withContext(Dispatchers.IO) { val request = URL(url) @@ -70,4 +74,4 @@ class UnknownMediaSourceFactory(dataSourceFactory: DataSource.Factory) : MediaSo loadErrorHandlingPolicy = DefaultLoadErrorHandlingPolicy() } -} \ No newline at end of file +}