diff --git a/app/build.gradle b/app/build.gradle index c0c6f3ffc8f..afe767517b4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -123,6 +123,8 @@ dependencies { // Media3 Casting implementation "androidx.media3:media3-cast:$exo_version" implementation "androidx.mediarouter:mediarouter:1.7.0" +// Media3 extension + implementation "com.github.anilbeesetti.nextlib:nextlib-media3ext:v0.7.0" // UI implementation 'com.google.android.material:material:1.12.0' diff --git a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt index 594a1d401a2..068e27d7e49 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt @@ -81,6 +81,7 @@ import androidx.media3.datasource.HttpDataSource import androidx.media3.datasource.cache.CacheDataSource import androidx.media3.datasource.okhttp.OkHttpDataSource import androidx.media3.exoplayer.DefaultLoadControl +import androidx.media3.exoplayer.DefaultRenderersFactory import androidx.media3.exoplayer.ExoPlayer import androidx.media3.exoplayer.hls.HlsMediaSource import androidx.media3.exoplayer.source.DefaultMediaSourceFactory @@ -165,6 +166,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get +import io.github.anilbeesetti.nextlib.media3ext.ffdecoder.NextRenderersFactory import java.util.Calendar import java.util.Locale import java.util.Timer @@ -1700,7 +1702,14 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL .build() hideSystemBars() - exoPlayer = ExoPlayer.Builder(this) + + val decoder = DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER + + val renderersFactory = NextRenderersFactory(this) + .setEnableDecoderFallback(true) + .setExtensionRendererMode(decoder) + + exoPlayer = ExoPlayer.Builder(this, renderersFactory) .setMediaSourceFactory(DefaultMediaSourceFactory(cacheFactory)) .setTrackSelector(trackSelector) .setLoadControl(loadControl) @@ -2382,4 +2391,4 @@ class CustomCastButton : MediaRouteButton { true } } -} \ No newline at end of file +}