Revert ExoPlayer back to default http backend (#7250)
Basically reverts 186de76d95
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.
This commit is contained in:
parent
155d769fca
commit
87355b528c
|
@ -29,7 +29,6 @@ dependencies {
|
||||||
implementation "androidx.core:core:$coreVersion"
|
implementation "androidx.core:core:$coreVersion"
|
||||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||||
implementation "androidx.media:media:$mediaVersion"
|
implementation "androidx.media:media:$mediaVersion"
|
||||||
implementation "androidx.media3:media3-datasource-okhttp:$media3Version"
|
|
||||||
implementation "androidx.media3:media3-exoplayer:$media3Version"
|
implementation "androidx.media3:media3-exoplayer:$media3Version"
|
||||||
implementation "androidx.media3:media3-ui:$media3Version"
|
implementation "androidx.media3:media3-ui:$media3Version"
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@ import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.database.StandaloneDatabaseProvider;
|
import androidx.media3.database.StandaloneDatabaseProvider;
|
||||||
import androidx.media3.datasource.DataSource;
|
import androidx.media3.datasource.DataSource;
|
||||||
import androidx.media3.datasource.DefaultDataSource;
|
import androidx.media3.datasource.DefaultDataSource;
|
||||||
|
import androidx.media3.datasource.DefaultHttpDataSource;
|
||||||
import androidx.media3.datasource.HttpDataSource;
|
import androidx.media3.datasource.HttpDataSource;
|
||||||
import androidx.media3.datasource.cache.CacheDataSource;
|
import androidx.media3.datasource.cache.CacheDataSource;
|
||||||
import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor;
|
import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor;
|
||||||
import androidx.media3.datasource.cache.SimpleCache;
|
import androidx.media3.datasource.cache.SimpleCache;
|
||||||
import androidx.media3.datasource.okhttp.OkHttpDataSource;
|
|
||||||
import androidx.media3.exoplayer.DefaultLoadControl;
|
import androidx.media3.exoplayer.DefaultLoadControl;
|
||||||
import androidx.media3.exoplayer.DefaultRenderersFactory;
|
import androidx.media3.exoplayer.DefaultRenderersFactory;
|
||||||
import androidx.media3.common.Format;
|
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.model.feed.VolumeAdaptionSetting;
|
||||||
import de.danoeh.antennapod.playback.service.R;
|
import de.danoeh.antennapod.playback.service.R;
|
||||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
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.HttpCredentialEncoder;
|
||||||
import de.danoeh.antennapod.net.common.NetworkUtils;
|
import de.danoeh.antennapod.net.common.NetworkUtils;
|
||||||
import de.danoeh.antennapod.model.playback.Playable;
|
import de.danoeh.antennapod.model.playback.Playable;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
import okhttp3.Call;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -235,16 +233,14 @@ public class ExoPlayerWrapper {
|
||||||
public void setDataSource(String s, String user, String password)
|
public void setDataSource(String s, String user, String password)
|
||||||
throws IllegalArgumentException, IllegalStateException {
|
throws IllegalArgumentException, IllegalStateException {
|
||||||
Log.d(TAG, "setDataSource: " + s);
|
Log.d(TAG, "setDataSource: " + s);
|
||||||
final OkHttpDataSource.Factory httpDataSourceFactory =
|
final DefaultHttpDataSource.Factory httpDataSourceFactory = new DefaultHttpDataSource.Factory();
|
||||||
new OkHttpDataSource.Factory((Call.Factory) AntennapodHttpClient.getHttpClient())
|
httpDataSourceFactory.setUserAgent(UserAgentInterceptor.USER_AGENT);
|
||||||
.setUserAgent(UserAgentInterceptor.USER_AGENT);
|
httpDataSourceFactory.setAllowCrossProtocolRedirects(true);
|
||||||
|
httpDataSourceFactory.setKeepPostFor302Redirects(true);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(user) && !TextUtils.isEmpty(password)) {
|
if (!TextUtils.isEmpty(user) && !TextUtils.isEmpty(password)) {
|
||||||
final HashMap<String, String> requestProperties = new HashMap<>();
|
final HashMap<String, String> requestProperties = new HashMap<>();
|
||||||
requestProperties.put(
|
requestProperties.put("Authorization", HttpCredentialEncoder.encode(user, password, "ISO-8859-1"));
|
||||||
"Authorization",
|
|
||||||
HttpCredentialEncoder.encode(user, password, "ISO-8859-1")
|
|
||||||
);
|
|
||||||
httpDataSourceFactory.setDefaultRequestProperties(requestProperties);
|
httpDataSourceFactory.setDefaultRequestProperties(requestProperties);
|
||||||
}
|
}
|
||||||
DataSource.Factory dataSourceFactory = new DefaultDataSource.Factory(context, httpDataSourceFactory);
|
DataSource.Factory dataSourceFactory = new DefaultDataSource.Factory(context, httpDataSourceFactory);
|
||||||
|
|
Loading…
Reference in New Issue