Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NotesChapter
GSYVideoPlayer
提交
678e5a99
G
GSYVideoPlayer
项目概览
NotesChapter
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
8
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,体验更适合开发者的 AI 搜索 >>
提交
678e5a99
编写于
11月 22, 2016
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.1.8
上级
ff93aa80
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
256 addition
and
4 deletion
+256
-4
README.md
README.md
+35
-2
app/src/main/java/com/example/gsyvideoplayer/PlayActivity.java
...rc/main/java/com/example/gsyvideoplayer/PlayActivity.java
+7
-0
app/src/main/res/drawable/video_new_progress.xml
app/src/main/res/drawable/video_new_progress.xml
+28
-0
app/src/main/res/drawable/video_new_seekbar_progress.xml
app/src/main/res/drawable/video_new_seekbar_progress.xml
+28
-0
app/src/main/res/drawable/video_new_seekbar_thumb.xml
app/src/main/res/drawable/video_new_seekbar_thumb.xml
+5
-0
app/src/main/res/drawable/video_new_volume_progress_bg.xml
app/src/main/res/drawable/video_new_volume_progress_bg.xml
+19
-0
app/src/main/res/drawable/video_seek_new_thumb_normal.xml
app/src/main/res/drawable/video_seek_new_thumb_normal.xml
+8
-0
app/src/main/res/drawable/video_seek_new_thumb_press.xml
app/src/main/res/drawable/video_seek_new_thumb_press.xml
+8
-0
gradle.properties
gradle.properties
+1
-1
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
...rc/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
+18
-1
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/utils/CommonUtil.java
.../main/java/com/shuyu/gsyvideoplayer/utils/CommonUtil.java
+15
-0
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
...va/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
+3
-0
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
...om/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
+81
-0
未找到文件。
README.md
浏览文件 @
678e5a99
...
...
@@ -17,13 +17,13 @@
<dependency>
<groupId>com.shuyu</groupId>
<artifactId>gsyVideoPlayer</artifactId>
<version>1.1.
7
</version>
<version>1.1.
8
</version>
<type>pom</type>
</dependency>
```
```
compile 'com.shuyu:gsyVideoPlayer:1.1.
7
'
compile 'com.shuyu:gsyVideoPlayer:1.1.
8
'
```
## 效果,录屏下的屏幕旋转和实际有些出入
...
...
@@ -43,6 +43,39 @@ compile 'com.shuyu:gsyVideoPlayer:1.1.7'
*
<h4>
3、详情模式
</h4>
<img
src=
"https://github.com/CarGuo/GSYVideoPlayer/blob/master/04.gif"
width=
"240px"
height=
"426px"
/>
### 1.1.8 增加了对Cache如果文件如果出现播放异常就清除缓存文件的处理(预防),StandardGSYVideoPlayer增加了一些UI配置接口
```
/**
* 底部进度条-弹出的
*/
public void setBottomShowProgressBarDrawable(Drawable drawable, Drawable thumb)
/**
* 底部进度条-非弹出
*/
public void setBottomProgressBarDrawable(Drawable drawable)
/**
* 声音进度条
*/
public void setDialogVolumeProgressBar(Drawable drawable)
/**
* 中间进度条
*/
public void setDialogProgressBar(Drawable drawable)
/**
* 中间进度条字体颜色
*/
public void setDialogProgressColor(int highLightColor, int normalColor)
```
## 1.1.7 增加了第二种列表 ListVideoUtil可拖动小窗口支持
```
...
...
app/src/main/java/com/example/gsyvideoplayer/PlayActivity.java
浏览文件 @
678e5a99
...
...
@@ -72,6 +72,13 @@ public class PlayActivity extends AppCompatActivity {
}
});
videoPlayer
.
setBottomProgressBarDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
video_new_progress
));
videoPlayer
.
setDialogVolumeProgressBar
(
getResources
().
getDrawable
(
R
.
drawable
.
video_new_volume_progress_bg
));
videoPlayer
.
setDialogProgressBar
(
getResources
().
getDrawable
(
R
.
drawable
.
video_new_progress
));
videoPlayer
.
setBottomShowProgressBarDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
video_new_seekbar_progress
),
getResources
().
getDrawable
(
R
.
drawable
.
video_new_seekbar_thumb
));
videoPlayer
.
setDialogProgressColor
(
getResources
().
getColor
(
R
.
color
.
colorAccent
),
-
11
);
//是否可以滑动调整
videoPlayer
.
setIsTouchWiget
(
true
);
...
...
app/src/main/res/drawable/video_new_progress.xml
0 → 100644
浏览文件 @
678e5a99
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@android:id/background"
>
<shape>
<solid
android:color=
"#4c000000"
/>
<size
android:height=
"4.0dip"
/>
<corners
android:radius=
"1.0dip"
/>
</shape>
</item>
<item
android:id=
"@android:id/secondaryProgress"
>
<clip>
<shape>
<solid
android:color=
"#ffe0e0e0"
/>
<size
android:height=
"4.0dip"
/>
<corners
android:radius=
"1.0dip"
/>
</shape>
</clip>
</item>
<item
android:id=
"@android:id/progress"
>
<clip>
<shape>
<solid
android:color=
"@color/colorAccent"
/>
<size
android:height=
"4.0dip"
/>
<corners
android:radius=
"1.0dip"
/>
</shape>
</clip>
</item>
</layer-list>
app/src/main/res/drawable/video_new_seekbar_progress.xml
0 → 100644
浏览文件 @
678e5a99
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@android:id/background"
>
<shape>
<solid
android:color=
"#cc999999"
/>
<size
android:height=
"3dp"
/>
<corners
android:radius=
"1.5dp"
/>
</shape>
</item>
<item
android:id=
"@android:id/secondaryProgress"
>
<clip>
<shape>
<solid
android:color=
"#ffe0e0e0"
/>
<size
android:height=
"3dp"
/>
<corners
android:radius=
"1.5dp"
/>
</shape>
</clip>
</item>
<item
android:id=
"@android:id/progress"
>
<clip>
<shape>
<solid
android:color=
"@color/colorAccent"
/>
<size
android:height=
"3dp"
/>
<corners
android:radius=
"1.5dp"
/>
</shape>
</clip>
</item>
</layer-list>
app/src/main/res/drawable/video_new_seekbar_thumb.xml
0 → 100644
浏览文件 @
678e5a99
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
android:drawable=
"@drawable/video_seek_new_thumb_press"
/>
<item
android:drawable=
"@drawable/video_seek_new_thumb_normal"
/>
</selector>
app/src/main/res/drawable/video_new_volume_progress_bg.xml
0 → 100644
浏览文件 @
678e5a99
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@android:id/background"
>
<shape>
<solid
android:color=
"#ffffffff"
/>
<corners
android:radius=
"2.0dip"
/>
</shape>
</item>
<item
android:id=
"@android:id/progress"
>
<clip
android:clipOrientation=
"vertical"
android:gravity=
"bottom"
>
<shape>
<solid
android:color=
"@color/colorAccent"
/>
<corners
android:radius=
"2.0dip"
/>
</shape>
</clip>
</item>
</layer-list>
app/src/main/res/drawable/video_seek_new_thumb_normal.xml
0 → 100644
浏览文件 @
678e5a99
<?xml version="1.0" encoding="utf-8"?>
<shape
android:shape=
"oval"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/colorPrimary"
/>
<size
android:height=
"12dp"
android:width=
"12dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/video_seek_new_thumb_press.xml
0 → 100644
浏览文件 @
678e5a99
<?xml version="1.0" encoding="utf-8"?>
<shape
android:shape=
"oval"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/colorPrimaryDark"
/>
<size
android:height=
"12dp"
android:width=
"12dp"
/>
</shape>
\ No newline at end of file
gradle.properties
浏览文件 @
678e5a99
...
...
@@ -18,7 +18,7 @@ org.gradle.jvmargs=-Xmx1536m
BINTRAY_USER
=
BINTRAY_KEY
=
PROJ_GROUP
=
com.shuyu
PROJ_VERSION
=
1.1.
7
PROJ_VERSION
=
1.1.
8
PROJ_NAME
=
gsyVideo
PROJ_WEBSITEURL
=
hhttps://github.com/CarGuo/GSYVideoPlayer
PROJ_ISSUETRACKERURL
=
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
浏览文件 @
678e5a99
...
...
@@ -8,6 +8,7 @@ import android.media.MediaPlayer;
import
android.os.Handler
;
import
android.text.TextUtils
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.view.MotionEvent
;
import
android.view.Surface
;
import
android.view.TextureView
;
...
...
@@ -28,6 +29,7 @@ import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack;
import
com.shuyu.gsyvideoplayer.utils.CommonUtil
;
import
com.shuyu.gsyvideoplayer.video.GSYBaseVideoPlayer
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Timer
;
...
...
@@ -127,6 +129,8 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
protected
boolean
mLooping
=
false
;
//// TODO: 2016/11/13 循环
protected
boolean
mCacheFile
=
false
;
//是否是缓存的文件
/**
* 当前UI
...
...
@@ -191,9 +195,12 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
(
System
.
currentTimeMillis
()
-
CLICK_QUIT_FULLSCREEN_TIME
)
<
FULL_SCREEN_NORMAL_DELAY
)
return
false
;
mCurrentState
=
CURRENT_STATE_NORMAL
;
if
(
cacheWithPlay
&&
url
.
startsWith
(
"http"
))
{
if
(
cacheWithPlay
&&
url
.
startsWith
(
"http"
)
&&
!
url
.
contains
(
"127.0.0.1"
))
{
mOriginUrl
=
url
;
HttpProxyCacheServer
proxy
=
GSYVideoManager
.
getProxy
(
getContext
().
getApplicationContext
());
url
=
proxy
.
getProxyUrl
(
url
);
mCacheFile
=
(!
url
.
startsWith
(
"http"
));
//Log.i(TAG, "mCacheFile " + mCacheFile + " " + url);
}
this
.
mUrl
=
url
;
this
.
mObjects
=
objects
;
...
...
@@ -740,6 +747,16 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
public
void
onError
(
int
what
,
int
extra
)
{
if
(
what
!=
38
&&
what
!=
-
38
)
{
setStateAndUi
(
CURRENT_STATE_ERROR
);
if
(
mCacheFile
)
{
Log
.
e
(
TAG
,
" mCacheFile Local Error "
+
mUrl
);
//可能是因为缓存文件除了问题
CommonUtil
.
deleteFile
(
mUrl
.
replace
(
"file://"
,
""
));
mUrl
=
mOriginUrl
;
}
else
if
(
mUrl
.
contains
(
"127.0.0.1"
))
{
Log
.
e
(
TAG
,
" mCacheFile Download Error "
+
mUrl
);
CommonUtil
.
deleteFile
(
mUrl
.
replace
(
"file://"
,
""
)
+
".downlad"
);
mUrl
=
mOriginUrl
;
}
}
}
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/utils/CommonUtil.java
浏览文件 @
678e5a99
...
...
@@ -12,6 +12,7 @@ import android.util.DisplayMetrics;
import
android.util.TypedValue
;
import
android.view.WindowManager
;
import
java.io.File
;
import
java.util.Formatter
;
import
java.util.Locale
;
...
...
@@ -183,5 +184,19 @@ public class CommonUtil {
return
outMetrics
.
heightPixels
;
}
public
static
void
deleteFile
(
String
filePath
)
{
File
file
=
new
File
(
filePath
);
if
(
file
.
exists
())
{
if
(
file
.
isFile
())
{
file
.
delete
();
}
else
{
String
[]
filePaths
=
file
.
list
();
for
(
String
path
:
filePaths
)
{
deleteFile
(
filePath
+
File
.
separator
+
path
);
}
file
.
delete
();
}
}
}
}
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
浏览文件 @
678e5a99
...
...
@@ -64,8 +64,11 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
protected
Context
mContext
;
protected
String
mOriginUrl
;
//原来的url
protected
String
mUrl
;
protected
Object
[]
mObjects
;
protected
ViewGroup
mTextureViewContainer
;
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
浏览文件 @
678e5a99
...
...
@@ -5,6 +5,7 @@ import android.app.AlertDialog;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.graphics.drawable.Drawable
;
import
android.text.TextUtils
;
import
android.util.AttributeSet
;
import
android.view.Gravity
;
...
...
@@ -73,6 +74,16 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
protected
TextView
mDialogTotalTime
;
protected
ImageView
mDialogIcon
;
protected
Drawable
mBottomProgressDrawable
;
protected
Drawable
mBottomShowProgressDrawable
;
protected
Drawable
mBottomShowProgressThumbDrawable
;
protected
Drawable
mVolumeProgressDrawable
;
protected
Drawable
mDialogProgressBarDrawable
;
private
int
mDialogProgressHighLightColor
=
-
11
;
private
int
mDialogProgressNormalColor
=
-
11
;
public
void
setStandardVideoAllCallBack
(
StandardVideoAllCallBack
standardVideoAllCallBack
)
{
this
.
mStandardVideoAllCallBack
=
standardVideoAllCallBack
;
...
...
@@ -104,6 +115,19 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
resolveThumbImage
(
mThumbImageView
);
}
if
(
mBottomProgressDrawable
!=
null
)
{
mBottomProgressBar
.
setProgressDrawable
(
mBottomProgressDrawable
);
}
if
(
mBottomShowProgressDrawable
!=
null
)
{
mProgressBar
.
setProgressDrawable
(
mBottomProgressDrawable
);
}
if
(
mBottomShowProgressThumbDrawable
!=
null
)
{
mProgressBar
.
setThumb
(
mBottomShowProgressThumbDrawable
);
}
}
@Override
...
...
@@ -463,6 +487,9 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
if
(
mProgressDialog
==
null
)
{
View
localView
=
LayoutInflater
.
from
(
getContext
()).
inflate
(
R
.
layout
.
video_progress_dialog
,
null
);
mDialogProgressBar
=
((
ProgressBar
)
localView
.
findViewById
(
R
.
id
.
duration_progressbar
));
if
(
mDialogProgressBarDrawable
!=
null
)
{
mDialogProgressBar
.
setProgressDrawable
(
mDialogProgressBarDrawable
);
}
mDialogSeekTime
=
((
TextView
)
localView
.
findViewById
(
R
.
id
.
tv_current
));
mDialogTotalTime
=
((
TextView
)
localView
.
findViewById
(
R
.
id
.
tv_duration
));
mDialogIcon
=
((
ImageView
)
localView
.
findViewById
(
R
.
id
.
duration_image_tip
));
...
...
@@ -472,6 +499,12 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
mProgressDialog
.
getWindow
().
addFlags
(
32
);
mProgressDialog
.
getWindow
().
addFlags
(
16
);
mProgressDialog
.
getWindow
().
setLayout
(-
2
,
-
2
);
if
(
mDialogProgressNormalColor
!=
-
11
)
{
mDialogTotalTime
.
setTextColor
(
mDialogProgressNormalColor
);
}
if
(
mDialogProgressHighLightColor
!=
-
11
)
{
mDialogSeekTime
.
setTextColor
(
mDialogProgressHighLightColor
);
}
WindowManager
.
LayoutParams
localLayoutParams
=
mProgressDialog
.
getWindow
().
getAttributes
();
localLayoutParams
.
gravity
=
Gravity
.
CENTER
;
//localLayoutParams.y = getResources().getDimensionPixelOffset(R.dimen.video_progress_dialog_margin_top);
...
...
@@ -506,6 +539,9 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
if
(
mVolumeDialog
==
null
)
{
View
localView
=
LayoutInflater
.
from
(
getContext
()).
inflate
(
R
.
layout
.
video_volume_dialog
,
null
);
mDialogVolumeProgressBar
=
((
ProgressBar
)
localView
.
findViewById
(
R
.
id
.
volume_progressbar
));
if
(
mVolumeProgressDrawable
!=
null
)
{
mDialogVolumeProgressBar
.
setProgressDrawable
(
mVolumeProgressDrawable
);
}
mVolumeDialog
=
new
Dialog
(
getContext
(),
R
.
style
.
video_style_dialog_progress
);
mVolumeDialog
.
setContentView
(
localView
);
mVolumeDialog
.
getWindow
().
addFlags
(
8
);
...
...
@@ -642,4 +678,49 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
clearFullscreenLayout
();
}
/**
* 底部进度条-弹出的
*/
public
void
setBottomShowProgressBarDrawable
(
Drawable
drawable
,
Drawable
thumb
)
{
mBottomShowProgressDrawable
=
drawable
;
mBottomShowProgressThumbDrawable
=
thumb
;
if
(
mProgressBar
!=
null
)
{
mProgressBar
.
setProgressDrawable
(
drawable
);
mProgressBar
.
setThumb
(
thumb
);
}
}
/**
* 底部进度条-非弹出
*/
public
void
setBottomProgressBarDrawable
(
Drawable
drawable
)
{
mBottomProgressDrawable
=
drawable
;
if
(
mBottomProgressBar
!=
null
)
{
mBottomProgressBar
.
setProgressDrawable
(
drawable
);
}
}
/**
* 声音进度条
*/
public
void
setDialogVolumeProgressBar
(
Drawable
drawable
)
{
mVolumeProgressDrawable
=
drawable
;
}
/**
* 中间进度条
*/
public
void
setDialogProgressBar
(
Drawable
drawable
)
{
mDialogProgressBarDrawable
=
drawable
;
}
/**
* 中间进度条字体颜色
*/
public
void
setDialogProgressColor
(
int
highLightColor
,
int
normalColor
)
{
mDialogProgressHighLightColor
=
highLightColor
;
mDialogProgressNormalColor
=
normalColor
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录