summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-08-30 18:11:26 +0200
committerGitHub <noreply@github.com>2024-08-30 18:11:26 +0200
commit936bfa029ef5fd6cc85d9f0fd448c4c19e767822 (patch)
tree30604fcc733145f3d15b29b076bb6c48af8abf1d
parent279d37e8bb3b32402121f85830a50db364c3309d (diff)
downloadAntennaPod-936bfa029ef5fd6cc85d9f0fd448c4c19e767822.zip
Increase buffer duration (#7362)
When podcasts use dynamic ad insertion and the media file changes between different network requests, users might experience jumps. Now, try to basically download the whole episode as soon as one hits the play button. That should avoid most of the jumps.
-rw-r--r--playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java
index 8a5c60b5d..9816c2231 100644
--- a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java
+++ b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java
@@ -47,7 +47,6 @@ import androidx.media3.ui.TrackNameProvider;
import de.danoeh.antennapod.net.common.UserAgentInterceptor;
import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting;
import de.danoeh.antennapod.playback.service.R;
-import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.net.common.HttpCredentialEncoder;
import de.danoeh.antennapod.net.common.NetworkUtils;
import de.danoeh.antennapod.model.playback.Playable;
@@ -97,10 +96,10 @@ public class ExoPlayerWrapper {
private void createPlayer() {
DefaultLoadControl.Builder loadControl = new DefaultLoadControl.Builder();
- loadControl.setBufferDurationsMs(30000, 120000,
+ loadControl.setBufferDurationsMs((int) TimeUnit.HOURS.toMillis(1), (int) TimeUnit.HOURS.toMillis(3),
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS,
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS);
- loadControl.setBackBuffer(UserPreferences.getRewindSecs() * 1000 + 500, true);
+ loadControl.setBackBuffer((int) TimeUnit.MINUTES.toMillis(5), true);
trackSelector = new DefaultTrackSelector(context);
exoPlayer = new ExoPlayer.Builder(context, new DefaultRenderersFactory(context))
.setTrackSelector(trackSelector)
@@ -154,7 +153,7 @@ public class ExoPlayerWrapper {
}
});
simpleCache = new SimpleCache(new File(context.getCacheDir(), "streaming"),
- new LeastRecentlyUsedCacheEvictor(50 * 1024 * 1024), new StandaloneDatabaseProvider(context));
+ new LeastRecentlyUsedCacheEvictor(100 * 1024 * 1024), new StandaloneDatabaseProvider(context));
initLoudnessEnhancer(exoPlayer.getAudioSessionId());
}