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

增加 allowCrossProtocolRedirects 支持

上级 59e6253f
......@@ -84,12 +84,13 @@ public class DetailPlayer extends AppCompatActivity {
Map<String, String> 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)
......
......@@ -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<String, String> 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<String, String> header : mMapHeadData.entrySet()) {
dataSourceFactory.getDefaultRequestProperties().set(header.getKey(), header.getValue());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册