diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-07-02 16:44:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-02 16:44:58 +0200 |
commit | 87355b528c32e9b2d739f62c6256763c5882a083 (patch) | |
tree | a07b13ab6cd51f027d383c9fb1a66afde3994416 /playback | |
parent | 155d769fca0046f32693d0a8191f44438fc30e0f (diff) | |
download | AntennaPod-87355b528c32e9b2d739f62c6256763c5882a083.zip |
Revert ExoPlayer back to default http backend (#7250)
Basically reverts 186de76d95631bbdcd3cc4a2057321855b5a69aa
The OkHttp backend sometimes causes issues when servers cut the connection.
We had this happen after 1000s (about 17 minutes) for many users after upgrading OkHttp.
Removes proxy support for streaming.
Diffstat (limited to 'playback')
-rw-r--r-- | playback/service/build.gradle | 1 | ||||
-rw-r--r-- | playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java | 16 |
2 files changed, 6 insertions, 11 deletions
diff --git a/playback/service/build.gradle b/playback/service/build.gradle index 219565696..3f8b88a37 100644 --- a/playback/service/build.gradle +++ b/playback/service/build.gradle @@ -29,7 +29,6 @@ dependencies { implementation "androidx.core:core:$coreVersion" implementation "androidx.appcompat:appcompat:$appcompatVersion" implementation "androidx.media:media:$mediaVersion" - implementation "androidx.media3:media3-datasource-okhttp:$media3Version" implementation "androidx.media3:media3-exoplayer:$media3Version" implementation "androidx.media3:media3-ui:$media3Version" 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 22392a563..43f1f31ab 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 @@ -18,11 +18,11 @@ import androidx.media3.common.util.UnstableApi; import androidx.media3.database.StandaloneDatabaseProvider; import androidx.media3.datasource.DataSource; import androidx.media3.datasource.DefaultDataSource; +import androidx.media3.datasource.DefaultHttpDataSource; import androidx.media3.datasource.HttpDataSource; import androidx.media3.datasource.cache.CacheDataSource; import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor; import androidx.media3.datasource.cache.SimpleCache; -import androidx.media3.datasource.okhttp.OkHttpDataSource; import androidx.media3.exoplayer.DefaultLoadControl; import androidx.media3.exoplayer.DefaultRenderersFactory; import androidx.media3.common.Format; @@ -48,14 +48,12 @@ 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.AntennapodHttpClient; import de.danoeh.antennapod.net.common.HttpCredentialEncoder; import de.danoeh.antennapod.net.common.NetworkUtils; import de.danoeh.antennapod.model.playback.Playable; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.Disposable; -import okhttp3.Call; import java.io.File; import java.util.ArrayList; @@ -235,16 +233,14 @@ public class ExoPlayerWrapper { public void setDataSource(String s, String user, String password) throws IllegalArgumentException, IllegalStateException { Log.d(TAG, "setDataSource: " + s); - final OkHttpDataSource.Factory httpDataSourceFactory = - new OkHttpDataSource.Factory((Call.Factory) AntennapodHttpClient.getHttpClient()) - .setUserAgent(UserAgentInterceptor.USER_AGENT); + final DefaultHttpDataSource.Factory httpDataSourceFactory = new DefaultHttpDataSource.Factory(); + httpDataSourceFactory.setUserAgent(UserAgentInterceptor.USER_AGENT); + httpDataSourceFactory.setAllowCrossProtocolRedirects(true); + httpDataSourceFactory.setKeepPostFor302Redirects(true); if (!TextUtils.isEmpty(user) && !TextUtils.isEmpty(password)) { final HashMap<String, String> requestProperties = new HashMap<>(); - requestProperties.put( - "Authorization", - HttpCredentialEncoder.encode(user, password, "ISO-8859-1") - ); + requestProperties.put("Authorization", HttpCredentialEncoder.encode(user, password, "ISO-8859-1")); httpDataSourceFactory.setDefaultRequestProperties(requestProperties); } DataSource.Factory dataSourceFactory = new DefaultDataSource.Factory(context, httpDataSourceFactory); |