From e64619219606ea2cf64a77fdc9642d2ee52426ef Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Thu, 28 Dec 2023 19:32:37 +0100 Subject: [PATCH] Enable tunneling in VideoManager --- .../jellyfin/androidtv/ui/playback/VideoManager.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/org/jellyfin/androidtv/ui/playback/VideoManager.java b/app/src/main/java/org/jellyfin/androidtv/ui/playback/VideoManager.java index 0618361b2..ef9742e9a 100644 --- a/app/src/main/java/org/jellyfin/androidtv/ui/playback/VideoManager.java +++ b/app/src/main/java/org/jellyfin/androidtv/ui/playback/VideoManager.java @@ -34,6 +34,7 @@ import androidx.media3.common.util.UnstableApi; import androidx.media3.exoplayer.DefaultRenderersFactory; import androidx.media3.exoplayer.ExoPlayer; import androidx.media3.exoplayer.source.DefaultMediaSourceFactory; +import androidx.media3.exoplayer.trackselection.DefaultTrackSelector; import androidx.media3.extractor.DefaultExtractorsFactory; import androidx.media3.extractor.ts.TsExtractor; import androidx.media3.ui.AspectRatioFrameLayout; @@ -205,6 +206,17 @@ public class VideoManager implements IVLCVout.OnNewVideoLayoutListener { defaultRendererFactory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON); exoPlayerBuilder.setRenderersFactory(defaultRendererFactory); + DefaultTrackSelector trackSelector = new DefaultTrackSelector(context); + trackSelector.setParameters(trackSelector.buildUponParameters() + .setTunnelingEnabled(true) + .setAudioOffloadPreferences(new TrackSelectionParameters.AudioOffloadPreferences.Builder() + .setAudioOffloadMode(TrackSelectionParameters.AudioOffloadPreferences.AUDIO_OFFLOAD_MODE_ENABLED) + .build() + ) + .build() + ); + exoPlayerBuilder.setTrackSelector(trackSelector); + DefaultExtractorsFactory defaultExtractorsFactory = new DefaultExtractorsFactory().setTsExtractorTimestampSearchBytes(TsExtractor.DEFAULT_TIMESTAMP_SEARCH_BYTES * 3); exoPlayerBuilder.setMediaSourceFactory(new DefaultMediaSourceFactory(context, defaultExtractorsFactory));