提交 74982a46 编写于 作者: G guoshuyu

增加 allowCrossProtocolRedirects 支持

上级 59e6253f
...@@ -84,12 +84,13 @@ public class DetailPlayer extends AppCompatActivity { ...@@ -84,12 +84,13 @@ public class DetailPlayer extends AppCompatActivity {
Map<String, String> header = new HashMap<>(); Map<String, String> header = new HashMap<>();
header.put("ee", "33"); header.put("ee", "33");
header.put("allowCrossProtocolRedirects", "true");
GSYVideoOptionBuilder gsyVideoOption = new GSYVideoOptionBuilder(); GSYVideoOptionBuilder gsyVideoOption = new GSYVideoOptionBuilder();
gsyVideoOption.setThumbImageView(imageView) gsyVideoOption.setThumbImageView(imageView)
.setIsTouchWiget(true) .setIsTouchWiget(true)
.setRotateViewAuto(false) .setRotateViewAuto(false)
.setLockLand(false) .setLockLand(false)
.setAutoFullWithSize(true) .setAutoFullWithSize(false)
.setShowFullAnimation(false) .setShowFullAnimation(false)
.setNeedLockFull(true) .setNeedLockFull(true)
.setUrl(url) .setUrl(url)
......
...@@ -3,7 +3,10 @@ package tv.danmaku.ijk.media.exo2; ...@@ -3,7 +3,10 @@ package tv.danmaku.ijk.media.exo2;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.net.Uri; import android.net.Uri;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import tv.danmaku.ijk.media.exo2.source.GSYExoHttpDataSource;
import tv.danmaku.ijk.media.exo2.source.GSYExoHttpDataSourceFactory; import tv.danmaku.ijk.media.exo2.source.GSYExoHttpDataSourceFactory;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -230,6 +233,7 @@ public class ExoSourceManager { ...@@ -230,6 +233,7 @@ public class ExoSourceManager {
/** /**
* 设置https忽略证书 * 设置https忽略证书
*
* @param skipSSLChain true时是hulve * @param skipSSLChain true时是hulve
*/ */
public static void setSkipSSLChain(boolean skipSSLChain) { public static void setSkipSSLChain(boolean skipSSLChain) {
...@@ -259,18 +263,24 @@ public class ExoSourceManager { ...@@ -259,18 +263,24 @@ public class ExoSourceManager {
} }
private DataSource.Factory getHttpDataSourceFactory(Context context, boolean preview) { 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, 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) { if (mMapHeadData != null && mMapHeadData.size() > 0) {
for (Map.Entry<String, String> header : mMapHeadData.entrySet()) { for (Map.Entry<String, String> header : mMapHeadData.entrySet()) {
dataSourceFactory.getDefaultRequestProperties().set(header.getKey(), header.getValue()); dataSourceFactory.getDefaultRequestProperties().set(header.getKey(), header.getValue());
} }
} }
return dataSourceFactory; return dataSourceFactory;
} }
DefaultHttpDataSourceFactory dataSourceFactory = new DefaultHttpDataSourceFactory(Util.getUserAgent(context, 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) { if (mMapHeadData != null && mMapHeadData.size() > 0) {
for (Map.Entry<String, String> header : mMapHeadData.entrySet()) { for (Map.Entry<String, String> header : mMapHeadData.entrySet()) {
dataSourceFactory.getDefaultRequestProperties().set(header.getKey(), header.getValue()); dataSourceFactory.getDefaultRequestProperties().set(header.getKey(), header.getValue());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册