Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ac13
GSYVideoPlayer
提交
56c89d19
G
GSYVideoPlayer
项目概览
ac13
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
GSYVideoPlayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
56c89d19
编写于
4月 02, 2019
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加https在exoplayer模式下增加忽略ssl证书支持
升级 exoplayer 到 2.9.6
上级
fa4c4758
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
708 addition
and
6 deletion
+708
-6
app/src/main/java/com/example/gsyvideoplayer/GSYApplication.java
.../main/java/com/example/gsyvideoplayer/GSYApplication.java
+3
-0
dependencies.gradle
dependencies.gradle
+1
-1
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java
...main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java
+29
-1
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/source/GSYExoHttpDataSource.java
...v/danmaku/ijk/media/exo2/source/GSYExoHttpDataSource.java
+546
-0
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/source/GSYExoHttpDataSourceFactory.java
...ku/ijk/media/exo2/source/GSYExoHttpDataSourceFactory.java
+125
-0
gsyVideoPlayer/build.gradle
gsyVideoPlayer/build.gradle
+4
-4
未找到文件。
app/src/main/java/com/example/gsyvideoplayer/GSYApplication.java
浏览文件 @
56c89d19
...
...
@@ -38,6 +38,9 @@ public class GSYApplication extends MultiDexApplication {
//GSYVideoType.enableMediaCodecTexture();
//PlayerFactory.setPlayManager(Exo2PlayerManager.class);//EXO模式
//ExoSourceManager.setSkipSSLChain(true);
//PlayerFactory.setPlayManager(SystemPlayerManager.class);//系统模式
//PlayerFactory.setPlayManager(IjkPlayerManager.class);//ijk模式
...
...
dependencies.gradle
浏览文件 @
56c89d19
...
...
@@ -34,7 +34,7 @@ ext {
gsyVideoVersion
=
'7.0.0-beta1'
exo_player2
=
'2.9.
5
'
exo_player2
=
'2.9.
6
'
permissionsdispatcher
=
'4.3.0'
...
...
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java
浏览文件 @
56c89d19
...
...
@@ -4,6 +4,8 @@ import android.annotation.SuppressLint;
import
android.content.Context
;
import
android.net.Uri
;
import
androidx.annotation.Nullable
;
import
tv.danmaku.ijk.media.exo2.source.GSYExoHttpDataSourceFactory
;
import
android.text.TextUtils
;
import
com.google.android.exoplayer2.C
;
...
...
@@ -46,8 +48,11 @@ public class ExoSourceManager {
public
static
final
int
TYPE_RTMP
=
4
;
private
static
Cache
mCache
;
/**
* 忽律Https证书校验
*/
private
static
boolean
mSkipSSLChain
=
false
;
private
Context
mAppContext
;
...
...
@@ -217,6 +222,19 @@ public class ExoSourceManager {
return
isCached
;
}
public
static
boolean
isSkipSSLChain
()
{
return
mSkipSSLChain
;
}
/**
* 设置https忽略证书
* @param skipSSLChain true时是hulve
*/
public
static
void
setSkipSSLChain
(
boolean
skipSSLChain
)
{
mSkipSSLChain
=
skipSSLChain
;
}
/**
* 获取SourceFactory,是否带Cache
*/
...
...
@@ -240,6 +258,16 @@ public class ExoSourceManager {
}
private
DataSource
.
Factory
getHttpDataSourceFactory
(
Context
context
,
boolean
preview
)
{
if
(
mSkipSSLChain
)
{
GSYExoHttpDataSourceFactory
dataSourceFactory
=
new
GSYExoHttpDataSourceFactory
(
Util
.
getUserAgent
(
context
,
TAG
),
preview
?
null
:
new
DefaultBandwidthMeter
());
if
(
mMapHeadData
!=
null
&&
mMapHeadData
.
size
()
>
0
)
{
for
(
Map
.
Entry
<
String
,
String
>
header
:
mMapHeadData
.
entrySet
())
{
dataSourceFactory
.
getDefaultRequestProperties
().
set
(
header
.
getKey
(),
header
.
getValue
());
}
}
return
dataSourceFactory
;
}
DefaultHttpDataSourceFactory
dataSourceFactory
=
new
DefaultHttpDataSourceFactory
(
Util
.
getUserAgent
(
context
,
TAG
),
preview
?
null
:
new
DefaultBandwidthMeter
());
if
(
mMapHeadData
!=
null
&&
mMapHeadData
.
size
()
>
0
)
{
...
...
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/source/GSYExoHttpDataSource.java
0 → 100644
浏览文件 @
56c89d19
此差异已折叠。
点击以展开。
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/source/GSYExoHttpDataSourceFactory.java
0 → 100644
浏览文件 @
56c89d19
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
tv.danmaku.ijk.media.exo2.source
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.upstream.HttpDataSource.BaseFactory
;
import
com.google.android.exoplayer2.upstream.HttpDataSource.Factory
;
import
com.google.android.exoplayer2.upstream.TransferListener
;
import
androidx.annotation.Nullable
;
/**
A {@link Factory} that produces {@link GSYExoHttpDataSource} instances.
*/
public
final
class
GSYExoHttpDataSourceFactory
extends
BaseFactory
{
private
final
String
userAgent
;
private
final
@Nullable
TransferListener
listener
;
private
final
int
connectTimeoutMillis
;
private
final
int
readTimeoutMillis
;
private
final
boolean
allowCrossProtocolRedirects
;
/**
Constructs a GSYExoHttpDataSourceFactory. Sets {@link
GSYExoHttpDataSource#DEFAULT_CONNECT_TIMEOUT_MILLIS} as the connection timeout, {@link
GSYExoHttpDataSource#DEFAULT_READ_TIMEOUT_MILLIS} as the read timeout and disables
cross-protocol redirects.
@param userAgent The User-Agent string that should be used.
*/
public
GSYExoHttpDataSourceFactory
(
String
userAgent
)
{
this
(
userAgent
,
null
);
}
/**
Constructs a GSYExoHttpDataSourceFactory. Sets {@link
GSYExoHttpDataSource#DEFAULT_CONNECT_TIMEOUT_MILLIS} as the connection timeout, {@link
GSYExoHttpDataSource#DEFAULT_READ_TIMEOUT_MILLIS} as the read timeout and disables
cross-protocol redirects.
@param userAgent The User-Agent string that should be used.
@param listener An optional listener.
@see #GSYExoHttpDataSourceFactory(String, TransferListener, int, int, boolean)
*/
public
GSYExoHttpDataSourceFactory
(
String
userAgent
,
@Nullable
TransferListener
listener
)
{
this
(
userAgent
,
listener
,
GSYExoHttpDataSource
.
DEFAULT_CONNECT_TIMEOUT_MILLIS
,
GSYExoHttpDataSource
.
DEFAULT_READ_TIMEOUT_MILLIS
,
false
);
}
/**
@param userAgent The User-Agent string that should be used.
@param connectTimeoutMillis The connection timeout that should be used when requesting remote
data, in milliseconds. A timeout of zero is interpreted as an infinite timeout.
@param readTimeoutMillis The read timeout that should be used when requesting remote data, in
milliseconds. A timeout of zero is interpreted as an infinite timeout.
@param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
to HTTPS and vice versa) are enabled.
*/
public
GSYExoHttpDataSourceFactory
(
String
userAgent
,
int
connectTimeoutMillis
,
int
readTimeoutMillis
,
boolean
allowCrossProtocolRedirects
)
{
this
(
userAgent
,
/* listener= */
null
,
connectTimeoutMillis
,
readTimeoutMillis
,
allowCrossProtocolRedirects
);
}
/**
@param userAgent The User-Agent string that should be used.
@param listener An optional listener.
@param connectTimeoutMillis The connection timeout that should be used when requesting remote
data, in milliseconds. A timeout of zero is interpreted as an infinite timeout.
@param readTimeoutMillis The read timeout that should be used when requesting remote data, in
milliseconds. A timeout of zero is interpreted as an infinite timeout.
@param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
to HTTPS and vice versa) are enabled.
*/
public
GSYExoHttpDataSourceFactory
(
String
userAgent
,
@Nullable
TransferListener
listener
,
int
connectTimeoutMillis
,
int
readTimeoutMillis
,
boolean
allowCrossProtocolRedirects
)
{
this
.
userAgent
=
userAgent
;
this
.
listener
=
listener
;
this
.
connectTimeoutMillis
=
connectTimeoutMillis
;
this
.
readTimeoutMillis
=
readTimeoutMillis
;
this
.
allowCrossProtocolRedirects
=
allowCrossProtocolRedirects
;
}
@Override
protected
GSYExoHttpDataSource
createDataSourceInternal
(
HttpDataSource
.
RequestProperties
defaultRequestProperties
)
{
GSYExoHttpDataSource
dataSource
=
new
GSYExoHttpDataSource
(
userAgent
,
/* contentTypePredicate= */
null
,
connectTimeoutMillis
,
readTimeoutMillis
,
allowCrossProtocolRedirects
,
defaultRequestProperties
);
if
(
listener
!=
null
)
{
dataSource
.
addTransferListener
(
listener
);
}
return
dataSource
;
}
}
gsyVideoPlayer/build.gradle
浏览文件 @
56c89d19
...
...
@@ -35,8 +35,8 @@ android {
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
//
api project(':gsyVideoPlayer-java')
//
api project(':gsyVideoPlayer-exo_player2')
api
project
(
':gsyVideoPlayer-java'
)
api
project
(
':gsyVideoPlayer-exo_player2'
)
//api project(':gsyVideoPlayer-armv5')
//api project(':gsyVideoPlayer-armv7a')
//api project(':gsyVideoPlayer-armv64')
...
...
@@ -48,8 +48,8 @@ dependencies {
//api "com.shuyu:GSYVideoPlayer:$gsyVideoVersion"
api
"com.shuyu:gsyVideoPlayer-java:$gsyVideoVersion"
api
"com.shuyu:GSYVideoPlayer-exo2:$gsyVideoVersion"
//
api "com.shuyu:gsyVideoPlayer-java:$gsyVideoVersion"
//
api "com.shuyu:GSYVideoPlayer-exo2:$gsyVideoVersion"
api
"com.shuyu:gsyVideoPlayer-armv5:$gsyVideoVersion"
api
"com.shuyu:gsyVideoPlayer-armv7a:$gsyVideoVersion"
api
"com.shuyu:gsyVideoPlayer-arm64:$gsyVideoVersion"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录