Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
沁852
GSYVideoPlayer
提交
d5c23a3e
G
GSYVideoPlayer
项目概览
沁852
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
9
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,发现更多精彩内容 >>
提交
d5c23a3e
编写于
11月 11, 2016
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix 注释
上级
50ee93a2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
67 addition
and
20 deletion
+67
-20
app/src/main/java/com/example/gsyvideoplayer/PlayActivity.java
...rc/main/java/com/example/gsyvideoplayer/PlayActivity.java
+17
-5
app/src/main/res/mipmap-xxhdpi/xxx1.jpg
app/src/main/res/mipmap-xxhdpi/xxx1.jpg
+0
-0
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
...om/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
+49
-14
gsyVideoPlayer/src/main/res/layout/video_layout_standard.xml
gsyVideoPlayer/src/main/res/layout/video_layout_standard.xml
+1
-1
未找到文件。
app/src/main/java/com/example/gsyvideoplayer/PlayActivity.java
浏览文件 @
d5c23a3e
...
...
@@ -8,6 +8,7 @@ import android.support.v4.view.ViewCompat;
import
android.support.v7.app.AppCompatActivity
;
import
android.transition.Transition
;
import
android.view.View
;
import
android.widget.ImageView
;
import
com.example.gsyvideoplayer.listener.OnTransitionListener
;
...
...
@@ -47,16 +48,24 @@ public class PlayActivity extends AppCompatActivity {
String
url
=
"http://baobab.wdjcdn.com/14564977406580.mp4"
;
videoPlayer
.
setUp
(
url
,
true
,
""
);
//Uri uri = Uri.parse(cover);
//standardPlayer.thumbImageView.setImageURI(uri);
//standardPlayer.titleTextView.setVisibility(View.GONE);
//增加封面
ImageView
imageView
=
new
ImageView
(
this
);
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_CROP
);
imageView
.
setImageResource
(
R
.
mipmap
.
xxx1
);
videoPlayer
.
setThumbImageView
(
imageView
);
//增加title
videoPlayer
.
getTitleTextView
().
setVisibility
(
View
.
VISIBLE
);
videoPlayer
.
getTitleTextView
().
setText
(
"测试视频"
);
//设置返回键
videoPlayer
.
getBackButton
().
setVisibility
(
View
.
VISIBLE
);
videoPlayer
.
setIsTouchWiget
(
true
);
//设置旋转
orientationUtils
=
new
OrientationUtils
(
this
,
videoPlayer
);
//设置全屏按键功能
videoPlayer
.
getFullscreenButton
().
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
...
...
@@ -64,6 +73,7 @@ public class PlayActivity extends AppCompatActivity {
}
});
//设置返回按键功能
videoPlayer
.
getBackButton
().
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
...
...
@@ -71,6 +81,7 @@ public class PlayActivity extends AppCompatActivity {
}
});
//过渡动画
initTransition
();
}
...
...
@@ -93,11 +104,12 @@ public class PlayActivity extends AppCompatActivity {
@Override
public
void
onBackPressed
()
{
//先返回正常状态
if
(
orientationUtils
.
getScreenType
()
==
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
)
{
videoPlayer
.
getFullscreenButton
().
performClick
();
return
;
}
//释放所有
videoPlayer
.
setStandardVideoAllCallBack
(
null
);
GSYVideoPlayer
.
releaseAllVideos
();
if
(
isTransition
&&
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
...
...
app/src/main/res/mipmap-xxhdpi/xxx1.jpg
0 → 100644
浏览文件 @
d5c23a3e
48.9 KB
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
浏览文件 @
d5c23a3e
...
...
@@ -16,6 +16,7 @@ import android.view.Window;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
android.widget.ProgressBar
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
...
...
@@ -40,8 +41,9 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
protected
ImageView
backButton
;
protected
ProgressBar
bottomProgressBar
,
loadingProgressBar
;
protected
TextView
titleTextView
;
protected
ImageView
thumbImageView
;
protected
RelativeLayout
thumbImageViewLayout
;
protected
ImageView
coverImageView
;
private
View
thumbImageView
;
protected
Dialog
mBrightnessDialog
;
protected
TextView
mBrightnessDialogTv
;
...
...
@@ -72,12 +74,17 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomProgressBar
=
(
ProgressBar
)
findViewById
(
R
.
id
.
bottom_progressbar
);
titleTextView
=
(
TextView
)
findViewById
(
R
.
id
.
title
);
backButton
=
(
ImageView
)
findViewById
(
R
.
id
.
back
);
thumbImageView
=
(
ImageView
)
findViewById
(
R
.
id
.
thumb
);
thumbImageView
Layout
=
(
RelativeLayout
)
findViewById
(
R
.
id
.
thumb
);
coverImageView
=
(
ImageView
)
findViewById
(
R
.
id
.
cover
);
loadingProgressBar
=
(
ProgressBar
)
findViewById
(
R
.
id
.
loading
);
thumbImageView
.
setOnClickListener
(
this
);
thumbImageViewLayout
.
setVisibility
(
GONE
);
thumbImageViewLayout
.
setOnClickListener
(
this
);
backButton
.
setOnClickListener
(
this
);
if
(
thumbImageView
!=
null
)
{
thumbImageViewLayout
.
removeAllViews
();
resolveThumbImage
(
thumbImageView
);
}
}
...
...
@@ -283,7 +290,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
INVISIBLE
);
startButton
.
setVisibility
(
View
.
VISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
.
setVisibility
(
View
.
VISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
VISIBLE
);
coverImageView
.
setVisibility
(
View
.
VISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
updateStartImage
();
...
...
@@ -294,7 +301,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
VISIBLE
);
startButton
.
setVisibility
(
View
.
INVISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
VISIBLE
);
thumbImageView
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
INVISIBLE
);
coverImageView
.
setVisibility
(
View
.
VISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
}
...
...
@@ -303,7 +310,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
topContainer
.
setVisibility
(
View
.
INVISIBLE
);
bottomContainer
.
setVisibility
(
View
.
INVISIBLE
);
startButton
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
INVISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
coverImageView
.
setVisibility
(
View
.
VISIBLE
);
}
...
...
@@ -313,7 +320,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
VISIBLE
);
startButton
.
setVisibility
(
View
.
VISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
INVISIBLE
);
coverImageView
.
setVisibility
(
View
.
INVISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
updateStartImage
();
...
...
@@ -329,7 +336,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
VISIBLE
);
startButton
.
setVisibility
(
View
.
VISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
INVISIBLE
);
coverImageView
.
setVisibility
(
View
.
INVISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
updateStartImage
();
...
...
@@ -345,7 +352,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
VISIBLE
);
startButton
.
setVisibility
(
View
.
INVISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
VISIBLE
);
thumbImageView
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
INVISIBLE
);
coverImageView
.
setVisibility
(
View
.
INVISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
}
...
...
@@ -355,7 +362,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
INVISIBLE
);
startButton
.
setVisibility
(
View
.
INVISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
VISIBLE
);
thumbImageView
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
INVISIBLE
);
coverImageView
.
setVisibility
(
View
.
INVISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
VISIBLE
);
updateStartImage
();
...
...
@@ -366,7 +373,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
INVISIBLE
);
startButton
.
setVisibility
(
View
.
INVISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
INVISIBLE
);
coverImageView
.
setVisibility
(
View
.
INVISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
}
...
...
@@ -376,7 +383,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
VISIBLE
);
startButton
.
setVisibility
(
View
.
VISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
.
setVisibility
(
View
.
VISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
VISIBLE
);
coverImageView
.
setVisibility
(
View
.
INVISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
updateStartImage
();
...
...
@@ -387,7 +394,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
INVISIBLE
);
startButton
.
setVisibility
(
View
.
VISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
.
setVisibility
(
View
.
VISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
VISIBLE
);
coverImageView
.
setVisibility
(
View
.
INVISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
VISIBLE
);
updateStartImage
();
...
...
@@ -398,7 +405,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
bottomContainer
.
setVisibility
(
View
.
INVISIBLE
);
startButton
.
setVisibility
(
View
.
VISIBLE
);
loadingProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
.
setVisibility
(
View
.
INVISIBLE
);
thumbImageView
Layout
.
setVisibility
(
View
.
INVISIBLE
);
coverImageView
.
setVisibility
(
View
.
VISIBLE
);
bottomProgressBar
.
setVisibility
(
View
.
INVISIBLE
);
updateStartImage
();
...
...
@@ -566,6 +573,34 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
}
}
private
void
resolveThumbImage
(
View
thumb
)
{
thumbImageViewLayout
.
addView
(
thumb
);
ViewGroup
.
LayoutParams
layoutParams
=
thumb
.
getLayoutParams
();
layoutParams
.
height
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
layoutParams
.
width
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
thumb
.
setLayoutParams
(
layoutParams
);
}
/***
* 设置封面
*/
public
void
setThumbImageView
(
View
view
)
{
if
(
thumbImageViewLayout
!=
null
)
{
thumbImageView
=
view
;
resolveThumbImage
(
view
);
}
}
/***
* 清除封面
*/
public
void
clearThumbImageView
()
{
if
(
thumbImageViewLayout
!=
null
)
{
thumbImageViewLayout
.
removeAllViews
();
}
}
public
TextView
getTitleTextView
()
{
return
titleTextView
;
}
...
...
gsyVideoPlayer/src/main/res/layout/video_layout_standard.xml
浏览文件 @
d5c23a3e
...
...
@@ -24,7 +24,7 @@
android:layout_alignParentTop=
"true"
android:background=
"#222222"
/>
<
ImageView
<
RelativeLayout
android:id=
"@+id/thumb"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录