Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ac13
GSYVideoPlayer
提交
c8398b4f
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,发现更多精彩内容 >>
提交
c8398b4f
编写于
8月 27, 2020
作者:
G
guoshuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#2922 deprecated SkipSSLChain ,support api custom dataSoucre
上级
d3a382b2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
68 addition
and
34 deletion
+68
-34
app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java
...rc/main/java/com/example/gsyvideoplayer/DetailPlayer.java
+3
-3
app/src/main/java/com/example/gsyvideoplayer/GSYApplication.java
.../main/java/com/example/gsyvideoplayer/GSYApplication.java
+25
-8
app/src/main/java/com/example/gsyvideoplayer/source/GSYDefaultHttpDataSource.java
...ample/gsyvideoplayer/source/GSYDefaultHttpDataSource.java
+1
-1
app/src/main/java/com/example/gsyvideoplayer/source/GSYExoHttpDataSourceFactory.java
...le/gsyvideoplayer/source/GSYExoHttpDataSourceFactory.java
+1
-2
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoMediaSourceInterceptListener.java
...nmaku/ijk/media/exo2/ExoMediaSourceInterceptListener.java
+15
-0
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java
...main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java
+20
-17
gsyVideoPlayer/build.gradle
gsyVideoPlayer/build.gradle
+3
-3
未找到文件。
app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java
浏览文件 @
c8398b4f
...
...
@@ -134,8 +134,8 @@ public class DetailPlayer extends AppCompatActivity {
.
setRotateViewAuto
(
false
)
//仅仅横屏旋转,不变直
//.setOnlyRotateLand(true)
.
setLockLand
(
fals
e
)
.
setAutoFullWithSize
(
fals
e
)
.
setLockLand
(
tru
e
)
.
setAutoFullWithSize
(
tru
e
)
.
setShowFullAnimation
(
false
)
.
setNeedLockFull
(
true
)
.
setUrl
(
url
)
...
...
@@ -317,7 +317,7 @@ public class DetailPlayer extends AppCompatActivity {
//String url = "http://video.7k.cn/app_video/20171202/6c8cf3ea/v.m3u8.mp4";
//String url = "http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8";
//String url = "rtmp://ctc-zhenjiang04.rt1.gensee.com/5324e855b28b453db7b0ec226598b76c_171391_0_8801038305_1591077225_205d01b8/video";
String
url
=
"http://
9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f2
0.mp4"
;
String
url
=
"http://
video1.dgtle.com/backend%2F2020%2F3%2F0%2F%E6%88%91%E6%B2%A1%E6%9C%89%E7%BB%99%E4%B8%80%E5%8A%A08Pro%E5%81%9A%E8%AF%84%E6%B5%8B_%E5%8D%B4%E5%B8%A6%E7%9D%80%E5%AE%83%E6%BC%82%E6%B5%81.mp4_108
0.mp4"
;
//String url = "http://yongtaizx.xyz/20191230/t2Axgh3k/index.m3u8";
//String url = "https://pointshow.oss-cn-hangzhou.aliyuncs.com/McTk51586843620689.mp4";
//String url = "http://pointshow.oss-cn-hangzhou.aliyuncs.com/transcode/ORIGINAL/Mnbc61586842828593.mp4";
...
...
app/src/main/java/com/example/gsyvideoplayer/GSYApplication.java
浏览文件 @
c8398b4f
package
com.example.gsyvideoplayer
;
import
androidx.annotation.Nullable
;
import
androidx.multidex.MultiDexApplication
;
import
tv.danmaku.ijk.media.exo2.Exo2PlayerManager
;
import
tv.danmaku.ijk.media.exo2.ExoMediaSourceInterceptListener
;
import
tv.danmaku.ijk.media.exo2.ExoSourceManager
;
import
tv.danmaku.ijk.media.exo2.IjkExo2MediaPlayer
;
import
tv.danmaku.ijk.media.player.IMediaPlayer
;
import
com.example.gsyvideoplayer.source.GSYExoHttpDataSourceFactory
;
import
com.google.android.exoplayer2.DefaultLoadControl
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.hls.HlsMediaSource
;
import
com.google.android.exoplayer2.trackselection.DefaultTrackSelector
;
import
com.google.android.exoplayer2.upstream.DefaultBandwidthMeter
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.upstream.TransferListener
;
import
com.shuyu.gsyvideoplayer.GSYVideoManager
;
import
com.shuyu.gsyvideoplayer.model.GSYModel
;
import
com.shuyu.gsyvideoplayer.player.BasePlayerManager
;
...
...
@@ -18,6 +26,8 @@ import com.shuyu.gsyvideoplayer.utils.Debuger;
import
com.shuyu.gsyvideoplayer.utils.GSYVideoType
;
import
com.squareup.leakcanary.LeakCanary
;
import
java.io.File
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Util
.
inferContentType
;
/**
...
...
@@ -61,18 +71,25 @@ public class GSYApplication extends MultiDexApplication {
//IjkPlayerManager.setLogLevel(IjkMediaPlayer.IJK_LOG_SILENT);
/*
ExoSourceManager.setExoMediaSourceInterceptListener(new ExoMediaSourceInterceptListener() {
ExoSourceManager
.
setExoMediaSourceInterceptListener
(
new
ExoMediaSourceInterceptListener
()
{
@Override
public
MediaSource
getMediaSource
(
String
dataSource
,
boolean
preview
,
boolean
cacheEnable
,
boolean
isLooping
,
File
cacheDir
)
{
Uri contentUri = Uri.parse(dataSource);
int contentType = inferContentType(dataSource);
switch (contentType) {
case C.TYPE_HLS:
return new HlsMediaSource.Factory(CustomSourceTag.getDataSourceFactory(GSYApplication.this.getApplicationContext(), preview)).createMediaSource(contentUri);
}
//如果返回 null,就使用默认的
return
null
;
}
});*/
/**
* 通过自定义的 HttpDataSource ,可以设置自签证书或者忽略证书
* demo 里的 GSYExoHttpDataSourceFactory 使用的是忽略证书
* */
@Override
public
HttpDataSource
.
BaseFactory
getHttpDataSourceFactory
(
String
userAgent
,
@Nullable
TransferListener
listener
,
int
connectTimeoutMillis
,
int
readTimeoutMillis
,
boolean
allowCrossProtocolRedirects
)
{
//如果返回 null,就使用默认的
return
new
GSYExoHttpDataSourceFactory
(
userAgent
,
listener
,
connectTimeoutMillis
,
readTimeoutMillis
,
allowCrossProtocolRedirects
);
}
});
/*GSYVideoManager.instance().setPlayerInitSuccessListener(new IPlayerInitSuccessListener() {
///播放器初始化成果回调
...
...
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2
/source/GSYDefaultHttpDataSource.java
→
app/src/main/java/com/example/gsyvideoplayer
/source/GSYDefaultHttpDataSource.java
浏览文件 @
c8398b4f
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
tv.danmaku.ijk.media.exo2
.source
;
package
com.example.gsyvideoplayer
.source
;
import
android.net.Uri
;
import
android.text.TextUtils
;
...
...
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2
/source/GSYExoHttpDataSourceFactory.java
→
app/src/main/java/com/example/gsyvideoplayer
/source/GSYExoHttpDataSourceFactory.java
浏览文件 @
c8398b4f
...
...
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
tv.danmaku.ijk.media.exo2
.source
;
package
com.example.gsyvideoplayer
.source
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSource
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.upstream.HttpDataSource.BaseFactory
;
import
com.google.android.exoplayer2.upstream.HttpDataSource.Factory
;
...
...
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoMediaSourceInterceptListener.java
浏览文件 @
c8398b4f
package
tv.danmaku.ijk.media.exo2
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.upstream.TransferListener
;
import
java.io.File
;
...
...
@@ -19,4 +23,15 @@ public interface ExoMediaSourceInterceptListener {
* @return 返回不为空时,使用返回的自定义mediaSource
*/
MediaSource
getMediaSource
(
String
dataSource
,
boolean
preview
,
boolean
cacheEnable
,
boolean
isLooping
,
File
cacheDir
);
/**
* @return 返回不为空时,使用返回的自定义 HttpDataSource
*/
HttpDataSource
.
BaseFactory
getHttpDataSourceFactory
(
String
userAgent
,
@Nullable
TransferListener
listener
,
int
connectTimeoutMillis
,
int
readTimeoutMillis
,
boolean
allowCrossProtocolRedirects
);
}
gsyVideoPlayer-exo_player2/src/main/java/tv/danmaku/ijk/media/exo2/ExoSourceManager.java
浏览文件 @
c8398b4f
...
...
@@ -6,9 +6,6 @@ import android.net.Uri;
import
androidx.annotation.Nullable
;
import
tv.danmaku.ijk.media.exo2.source.GSYDefaultHttpDataSource
;
import
tv.danmaku.ijk.media.exo2.source.GSYExoHttpDataSourceFactory
;
import
android.text.TextUtils
;
import
com.google.android.exoplayer2.C
;
...
...
@@ -26,7 +23,9 @@ import com.google.android.exoplayer2.upstream.DataSource;
import
com.google.android.exoplayer2.upstream.DataSpec
;
import
com.google.android.exoplayer2.upstream.DefaultBandwidthMeter
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.upstream.RawResourceDataSource
;
import
com.google.android.exoplayer2.upstream.cache.Cache
;
import
com.google.android.exoplayer2.upstream.cache.CacheDataSource
;
...
...
@@ -57,7 +56,9 @@ public class ExoSourceManager {
private
static
Cache
mCache
;
/**
* 忽律Https证书校验
* @deprecated 如果需要忽略证书,请直接使用 ExoMediaSourceInterceptListener 的 getHttpDataSourceFactory
*/
@Deprecated
private
static
boolean
sSkipSSLChain
=
false
;
private
static
int
sHttpReadTimeout
=
-
1
;
...
...
@@ -259,7 +260,11 @@ public class ExoSourceManager {
return
isCached
;
}
/**
* 忽律Https证书校验
* @deprecated 如果需要忽略证书,请直接使用 ExoMediaSourceInterceptListener 的 getHttpDataSourceFactory
*/
@Deprecated
public
static
boolean
isSkipSSLChain
()
{
return
sSkipSSLChain
;
}
...
...
@@ -268,7 +273,9 @@ public class ExoSourceManager {
* 设置https忽略证书
*
* @param skipSSLChain true时是hulve
* @deprecated 如果需要忽略证书,请直接使用 ExoMediaSourceInterceptListener 的 getHttpDataSourceFactory
*/
@Deprecated
public
static
void
setSkipSSLChain
(
boolean
skipSSLChain
)
{
sSkipSSLChain
=
skipSSLChain
;
}
...
...
@@ -322,8 +329,8 @@ public class ExoSourceManager {
if
(
uerAgent
==
null
)
{
uerAgent
=
Util
.
getUserAgent
(
context
,
TAG
);
}
int
connectTimeout
=
GSY
DefaultHttpDataSource
.
DEFAULT_CONNECT_TIMEOUT_MILLIS
;
int
readTimeout
=
GSY
DefaultHttpDataSource
.
DEFAULT_READ_TIMEOUT_MILLIS
;
int
connectTimeout
=
DefaultHttpDataSource
.
DEFAULT_CONNECT_TIMEOUT_MILLIS
;
int
readTimeout
=
DefaultHttpDataSource
.
DEFAULT_READ_TIMEOUT_MILLIS
;
if
(
sHttpConnectTimeout
>
0
)
{
connectTimeout
=
sHttpConnectTimeout
;
}
...
...
@@ -334,20 +341,16 @@ public class ExoSourceManager {
if
(
mMapHeadData
!=
null
&&
mMapHeadData
.
size
()
>
0
)
{
allowCrossProtocolRedirects
=
"true"
.
equals
(
mMapHeadData
.
get
(
"allowCrossProtocolRedirects"
));
}
if
(
sSkipSSLChain
)
{
GSYExoHttpDataSourceFactory
dataSourceFactory
=
new
GSYExoHttpDataSourceFactory
(
uerAgent
,
preview
?
null
:
new
DefaultBandwidthMeter
.
Builder
(
mAppContext
).
build
(),
HttpDataSource
.
BaseFactory
dataSourceFactory
;
if
(
sExoMediaSourceInterceptListener
!=
null
)
{
dataSourceFactory
=
sExoMediaSourceInterceptListener
.
getHttpDataSourceFactory
(
uerAgent
,
preview
?
null
:
new
DefaultBandwidthMeter
.
Builder
(
mAppContext
).
build
(),
connectTimeout
,
readTimeout
,
allowCrossProtocolRedirects
);
}
else
{
dataSourceFactory
=
new
DefaultHttpDataSourceFactory
(
uerAgent
,
preview
?
null
:
new
DefaultBandwidthMeter
.
Builder
(
mAppContext
).
build
(),
connectTimeout
,
readTimeout
,
allowCrossProtocolRedirects
);
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
(
uerAgent
,
preview
?
null
:
new
DefaultBandwidthMeter
.
Builder
(
mAppContext
).
build
(),
connectTimeout
,
readTimeout
,
allowCrossProtocolRedirects
);
if
(
mMapHeadData
!=
null
&&
mMapHeadData
.
size
()
>
0
)
{
for
(
Map
.
Entry
<
String
,
String
>
header
:
mMapHeadData
.
entrySet
())
{
dataSourceFactory
.
getDefaultRequestProperties
().
set
(
header
.
getKey
(),
header
.
getValue
());
...
...
gsyVideoPlayer/build.gradle
浏览文件 @
c8398b4f
...
...
@@ -50,11 +50,11 @@ dependencies {
//api "com.shuyu:gsyVideoPlayer-java:$gsyVideoVersion"
//api "com.shuyu:GSYVideoPlayer-exo2:$gsyVideoVersion"
//
api "com.shuyu:gsyVideoPlayer-armv5:$gsyVideoVersion"
//
api "com.shuyu:gsyVideoPlayer-armv5:$gsyVideoVersion"
//api "com.shuyu:gsyVideoPlayer-armv7a:$gsyVideoVersion"
//api "com.shuyu:gsyVideoPlayer-arm64:$gsyVideoVersion"
//
api "com.shuyu:gsyVideoPlayer-x64:$gsyVideoVersion"
//
api "com.shuyu:gsyVideoPlayer-x86:$gsyVideoVersion"
//
api "com.shuyu:gsyVideoPlayer-x64:$gsyVideoVersion"
//
api "com.shuyu:gsyVideoPlayer-x86:$gsyVideoVersion"
//更多配置版so,增加了concat,rtsp,mpeg,crypto
//api "com.shuyu:gsyVideoPlayer-ex_so:$gsyVideoVersion"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录