diff --git a/app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java b/app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java index 1f15ecd6c06f04589f246f42061aa88af0056374..abf7b89c8e6b3f3b9a615cb75e1114fb95054003 100644 --- a/app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java +++ b/app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java @@ -84,12 +84,13 @@ public class DetailPlayer extends AppCompatActivity { Map header = new HashMap<>(); header.put("ee", "33"); + header.put("allowCrossProtocolRedirects", "true"); GSYVideoOptionBuilder gsyVideoOption = new GSYVideoOptionBuilder(); gsyVideoOption.setThumbImageView(imageView) .setIsTouchWiget(true) .setRotateViewAuto(false) .setLockLand(false) - .setAutoFullWithSize(true) + .setAutoFullWithSize(false) .setShowFullAnimation(false) .setNeedLockFull(true) .setUrl(url) diff --git a/gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java b/gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java index 27395df2e3e19c43c6f037a35da05af3f60397ce..38b0013763cf3eaad4d2b0bc929226b209ef4547 100644 --- a/gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java +++ b/gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java @@ -3,7 +3,10 @@ package tv.danmaku.ijk.media.exo2; import android.annotation.SuppressLint; import android.content.Context; import android.net.Uri; + import androidx.annotation.Nullable; + +import tv.danmaku.ijk.media.exo2.source.GSYExoHttpDataSource; import tv.danmaku.ijk.media.exo2.source.GSYExoHttpDataSourceFactory; import android.text.TextUtils; @@ -230,6 +233,7 @@ public class ExoSourceManager { /** * 设置https忽略证书 + * * @param skipSSLChain true时是hulve */ public static void setSkipSSLChain(boolean skipSSLChain) { @@ -259,18 +263,24 @@ public class ExoSourceManager { } private DataSource.Factory getHttpDataSourceFactory(Context context, boolean preview) { - if(mSkipSSLChain) { + boolean allowCrossProtocolRedirects = false; + if (mMapHeadData != null && mMapHeadData.size() > 0) { + allowCrossProtocolRedirects = "true".equals(mMapHeadData.get("allowCrossProtocolRedirects")); + } + if (mSkipSSLChain) { GSYExoHttpDataSourceFactory dataSourceFactory = new GSYExoHttpDataSourceFactory(Util.getUserAgent(context, - TAG), preview ? null : new DefaultBandwidthMeter()); + TAG), preview ? null : new DefaultBandwidthMeter(), GSYExoHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS, + GSYExoHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, allowCrossProtocolRedirects); if (mMapHeadData != null && mMapHeadData.size() > 0) { for (Map.Entry header : mMapHeadData.entrySet()) { dataSourceFactory.getDefaultRequestProperties().set(header.getKey(), header.getValue()); } } - return dataSourceFactory; + return dataSourceFactory; } DefaultHttpDataSourceFactory dataSourceFactory = new DefaultHttpDataSourceFactory(Util.getUserAgent(context, - TAG), preview ? null : new DefaultBandwidthMeter()); + TAG), preview ? null : new DefaultBandwidthMeter(), GSYExoHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS, + GSYExoHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, allowCrossProtocolRedirects); if (mMapHeadData != null && mMapHeadData.size() > 0) { for (Map.Entry header : mMapHeadData.entrySet()) { dataSourceFactory.getDefaultRequestProperties().set(header.getKey(), header.getValue());