Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ac13
GSYVideoPlayer
提交
3a6110b0
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,发现更多精彩内容 >>
提交
3a6110b0
编写于
9月 18, 2018
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #1455
上级
6648391e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
51 addition
and
34 deletion
+51
-34
app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java
...rc/main/java/com/example/gsyvideoplayer/DetailPlayer.java
+6
-1
gsyVideoPlayer-java/build.gradle
gsyVideoPlayer-java/build.gradle
+2
-2
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/cache/ProxyCacheManager.java
...ava/com/shuyu/gsyvideoplayer/cache/ProxyCacheManager.java
+15
-25
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/cache/ProxyCacheUserAgentHeadersInjector.java
...videoplayer/cache/ProxyCacheUserAgentHeadersInjector.java
+21
-0
gsyVideoPlayer-proxy_cache/src/main/java/com/danikula/videocache/HttpUrlSource.java
.../src/main/java/com/danikula/videocache/HttpUrlSource.java
+1
-0
gsyVideoPlayer/build.gradle
gsyVideoPlayer/build.gradle
+6
-6
未找到文件。
app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java
浏览文件 @
3a6110b0
...
...
@@ -24,7 +24,9 @@ import com.shuyu.gsyvideoplayer.utils.OrientationUtils;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
...
...
@@ -84,6 +86,8 @@ public class DetailPlayer extends AppCompatActivity {
//初始化不打开外部的旋转
orientationUtils
.
setEnable
(
false
);
Map
<
String
,
String
>
header
=
new
HashMap
<>();
header
.
put
(
"ee"
,
"33"
);
GSYVideoOptionBuilder
gsyVideoOption
=
new
GSYVideoOptionBuilder
();
gsyVideoOption
.
setThumbImageView
(
imageView
)
.
setIsTouchWiget
(
true
)
...
...
@@ -93,7 +97,8 @@ public class DetailPlayer extends AppCompatActivity {
.
setShowFullAnimation
(
false
)
.
setNeedLockFull
(
true
)
.
setUrl
(
url
)
.
setCacheWithPlay
(
false
)
.
setMapHeadData
(
header
)
.
setCacheWithPlay
(
true
)
.
setVideoTitle
(
"测试视频"
)
.
setVideoAllCallBack
(
new
GSYSampleCallBack
()
{
@Override
...
...
gsyVideoPlayer-java/build.gradle
浏览文件 @
3a6110b0
...
...
@@ -36,10 +36,10 @@ dependencies {
api
viewDependencies
.
ijkplayer_java
api
viewDependencies
.
ijkplayer_exo
api
viewDependencies
.
transitionseverywhere
//
api project(':gsyVideoPlayer-proxy_cache')
api
project
(
':gsyVideoPlayer-proxy_cache'
)
//api project(':gsyVideoPlayer-base')
api
"com.shuyu:gsyVideoPlayer-base:$gsyVideoVersion"
api
"com.shuyu:gsyvideoplayer-androidvideocache:$gsyVideoVersion"
//
api "com.shuyu:gsyvideoplayer-androidvideocache:$gsyVideoVersion"
// compile fileTree(dir: 'libs', include: ['*.jar'])
...
...
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/cache/ProxyCacheManager.java
浏览文件 @
3a6110b0
...
...
@@ -7,21 +7,19 @@ import android.text.TextUtils;
import
com.danikula.videocache.CacheListener
;
import
com.danikula.videocache.HttpProxyCacheServer
;
import
com.danikula.videocache.file.Md5FileNameGenerator
;
import
com.danikula.videocache.headers.HeaderInjector
;
import
com.shuyu.gsyvideoplayer.utils.CommonUtil
;
import
com.shuyu.gsyvideoplayer.utils.FileUtils
;
import
com.shuyu.gsyvideoplayer.utils.StorageUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
tv.danmaku.ijk.media.player.IMediaPlayer
;
/**
*
代理缓存管理器
*
Created by guoshuyu on 2018/5/18.
代理缓存管理器
Created by guoshuyu on 2018/5/18.
*/
public
class
ProxyCacheManager
implements
ICacheManager
,
CacheListener
{
...
...
@@ -29,7 +27,6 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
//视频代理
protected
HttpProxyCacheServer
proxy
;
protected
Map
<
String
,
String
>
mMapHeadData
;
protected
File
mCacheDir
;
...
...
@@ -39,8 +36,10 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
private
ICacheManager
.
ICacheAvailableListener
cacheAvailableListener
;
protected
ProxyCacheUserAgentHeadersInjector
userAgentHeadersInjector
=
new
ProxyCacheUserAgentHeadersInjector
();
/**
*
单例管理器
单例管理器
*/
public
static
synchronized
ProxyCacheManager
instance
()
{
if
(
proxyCacheManager
==
null
)
{
...
...
@@ -60,7 +59,10 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
@Override
public
void
doCacheLogic
(
Context
context
,
IMediaPlayer
mediaPlayer
,
String
originUrl
,
Map
<
String
,
String
>
header
,
File
cachePath
)
{
String
url
=
originUrl
;
mMapHeadData
=
header
;
userAgentHeadersInjector
.
mMapHeadData
.
clear
();
if
(
header
!=
null
)
{
userAgentHeadersInjector
.
mMapHeadData
.
putAll
(
header
);
}
if
(
url
.
startsWith
(
"http"
)
&&
!
url
.
contains
(
"127.0.0.1"
)
&&
!
url
.
contains
(
".m3u8"
))
{
HttpProxyCacheServer
proxy
=
getProxy
(
context
.
getApplicationContext
(),
cachePath
);
if
(
proxy
!=
null
)
{
...
...
@@ -144,7 +146,7 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
}
/**
*
创建缓存代理服务,带文件目录的.
创建缓存代理服务,带文件目录的.
*/
public
HttpProxyCacheServer
newProxy
(
Context
context
,
File
file
)
{
if
(!
file
.
exists
())
{
...
...
@@ -152,7 +154,7 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
}
HttpProxyCacheServer
.
Builder
builder
=
new
HttpProxyCacheServer
.
Builder
(
context
);
builder
.
cacheDirectory
(
file
);
builder
.
headerInjector
(
new
UserAgentHeadersInjector
()
);
builder
.
headerInjector
(
userAgentHeadersInjector
);
mCacheDir
=
file
;
return
builder
.
build
();
}
...
...
@@ -162,27 +164,16 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
}
/**
*
创建缓存代理服务
创建缓存代理服务
*/
public
HttpProxyCacheServer
newProxy
(
Context
context
)
{
return
new
HttpProxyCacheServer
.
Builder
(
context
.
getApplicationContext
())
.
headerInjector
(
new
UserAgentHeadersInjector
()).
build
();
}
/**
* for android video cache header
*/
private
class
UserAgentHeadersInjector
implements
HeaderInjector
{
@Override
public
Map
<
String
,
String
>
addHeaders
(
String
url
)
{
return
(
mMapHeadData
==
null
)
?
new
HashMap
<
String
,
String
>()
:
mMapHeadData
;
}
.
headerInjector
(
userAgentHeadersInjector
).
build
();
}
/**
*
获取缓存代理服务
获取缓存代理服务
*/
protected
static
HttpProxyCacheServer
getProxy
(
Context
context
)
{
HttpProxyCacheServer
proxy
=
ProxyCacheManager
.
instance
().
proxy
;
...
...
@@ -192,7 +183,7 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
/**
*
获取缓存代理服务,带文件目录的
获取缓存代理服务,带文件目录的
*/
public
static
HttpProxyCacheServer
getProxy
(
Context
context
,
File
file
)
{
...
...
@@ -222,5 +213,4 @@ public class ProxyCacheManager implements ICacheManager, CacheListener {
}
}
}
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/cache/ProxyCacheUserAgentHeadersInjector.java
0 → 100644
浏览文件 @
3a6110b0
package
com.shuyu.gsyvideoplayer.cache
;
import
com.danikula.videocache.headers.HeaderInjector
;
import
com.shuyu.gsyvideoplayer.utils.Debuger
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
for android video cache header
*/
public
class
ProxyCacheUserAgentHeadersInjector
implements
HeaderInjector
{
public
final
static
Map
<
String
,
String
>
mMapHeadData
=
new
HashMap
<>();
@Override
public
Map
<
String
,
String
>
addHeaders
(
String
url
)
{
Debuger
.
printfLog
(
"****** proxy addHeaders ****** "
+
mMapHeadData
.
size
());
return
mMapHeadData
;
}
}
\ No newline at end of file
gsyVideoPlayer-proxy_cache/src/main/java/com/danikula/videocache/HttpUrlSource.java
浏览文件 @
3a6110b0
...
...
@@ -180,6 +180,7 @@ public class HttpUrlSource implements Source {
if
(
extraHeaders
==
null
)
{
return
;
}
HttpProxyCacheDebuger
.
printfError
(
"****** injectCustomHeaders ****** :"
+
extraHeaders
.
size
());
for
(
Map
.
Entry
<
String
,
String
>
header
:
extraHeaders
.
entrySet
())
{
connection
.
setRequestProperty
(
header
.
getKey
(),
header
.
getValue
());
}
...
...
gsyVideoPlayer/build.gradle
浏览文件 @
3a6110b0
...
...
@@ -40,17 +40,17 @@ dependencies {
//api project(':gsyVideoPlayer-x86_64')
//更多配置版so,增加了concat,rtsp,mpeg,crypto
//
api project(':gsyVideoPlayer-ex_so')
api
project
(
':gsyVideoPlayer-ex_so'
)
//api "com.shuyu:GSYVideoPlayer:$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"
api
"com.shuyu:gsyVideoPlayer-x64:$gsyVideoVersion"
api
"com.shuyu:gsyVideoPlayer-x86:$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"
//更多配置版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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录