Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NotesChapter
GSYVideoPlayer
提交
15f9a3ba
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 搜索 >>
提交
15f9a3ba
编写于
4月 28, 2017
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加了全屏显示的支持 (2017-04-28)
上级
5a5f190d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
87 addition
and
22 deletion
+87
-22
README.md
README.md
+1
-0
UPDATE_VERSION.md
UPDATE_VERSION.md
+1
-0
app/src/main/java/com/example/gsyvideoplayer/PlayActivity.java
...rc/main/java/com/example/gsyvideoplayer/PlayActivity.java
+1
-1
app/src/main/java/com/example/gsyvideoplayer/video/SampleVideo.java
...in/java/com/example/gsyvideoplayer/video/SampleVideo.java
+20
-0
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYImageCover.java
...src/main/java/com/shuyu/gsyvideoplayer/GSYImageCover.java
+58
-7
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYTextureView.java
...rc/main/java/com/shuyu/gsyvideoplayer/GSYTextureView.java
+3
-14
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/utils/GSYVideoType.java
...ain/java/com/shuyu/gsyvideoplayer/utils/GSYVideoType.java
+3
-0
未找到文件。
README.md
浏览文件 @
15f9a3ba
...
...
@@ -106,6 +106,7 @@ dependencies {
### 1.6.5(未发布)
*
修改了循环播放的UI问题
*
修改了本地文件或者已缓存文件,显示进度问题
*
GSYVideoType增加SCREEN_TYPE_FULL类型,通过按照比例裁减放大视频,达到全屏
### 1.6.4(2017-04-20)
...
...
UPDATE_VERSION.md
浏览文件 @
15f9a3ba
...
...
@@ -3,6 +3,7 @@
### 1.6.5(未发布)
*
修改了循环播放的UI问题
*
修改了本地文件或者已缓存文件,显示进度问题
*
GSYVideoType增加SCREEN_TYPE_FULL类型,通过按照比例裁减放大视频,达到全屏
### 1.6.4(2017-04-20)
*
update ijk to 0.7.9 (增加了soundTouch,调速后声音变调问题得到解决)
...
...
app/src/main/java/com/example/gsyvideoplayer/PlayActivity.java
浏览文件 @
15f9a3ba
...
...
@@ -94,7 +94,7 @@ public class PlayActivity extends AppCompatActivity {
//设置旋转
orientationUtils
=
new
OrientationUtils
(
this
,
videoPlayer
);
//设置全屏按键功能
//设置全屏按键功能
,这是使用的是选择屏幕,而不是全屏
videoPlayer
.
getFullscreenButton
().
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
...
...
app/src/main/java/com/example/gsyvideoplayer/video/SampleVideo.java
浏览文件 @
15f9a3ba
...
...
@@ -20,6 +20,7 @@ import com.example.gsyvideoplayer.view.SwitchVideoTypeDialog;
import
com.shuyu.gsyvideoplayer.GSYVideoManager
;
import
com.shuyu.gsyvideoplayer.GSYVideoPlayer
;
import
com.shuyu.gsyvideoplayer.utils.GSYVideoType
;
import
com.shuyu.gsyvideoplayer.video.GSYBaseVideoPlayer
;
import
com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
;
import
java.io.File
;
...
...
@@ -30,6 +31,9 @@ import java.util.TimerTask;
/**
* Created by shuyu on 2016/12/7.
* 注意
* 这个播放器的demo配置切换到全屏播放器
* 这只是单纯的作为全屏播放显示,如果需要做大小屏幕切换,请记得在这里耶设置上视频全屏的需要的自定义配置
*/
public
class
SampleVideo
extends
StandardGSYVideoPlayer
{
...
...
@@ -91,6 +95,12 @@ public class SampleVideo extends StandardGSYVideoPlayer {
if
(
mTextureView
!=
null
)
mTextureView
.
requestLayout
();
}
else
if
(
mType
==
2
)
{
mType
=
3
;
mMoreScale
.
setText
(
"全屏"
);
GSYVideoType
.
setShowType
(
GSYVideoType
.
SCREEN_TYPE_FULL
);
if
(
mTextureView
!=
null
)
mTextureView
.
requestLayout
();
}
else
if
(
mType
==
3
)
{
mType
=
0
;
mMoreScale
.
setText
(
"默认比例"
);
GSYVideoType
.
setShowType
(
GSYVideoType
.
SCREEN_TYPE_DEFAULT
);
...
...
@@ -162,6 +172,16 @@ public class SampleVideo extends StandardGSYVideoPlayer {
return
R
.
layout
.
sample_video
;
}
@Override
public
GSYBaseVideoPlayer
startWindowFullscreen
(
Context
context
,
boolean
actionBar
,
boolean
statusBar
)
{
SampleVideo
sampleVideo
=
(
SampleVideo
)
super
.
startWindowFullscreen
(
context
,
actionBar
,
statusBar
);
//这个播放器的demo配置切换到全屏播放器
//这只是单纯的作为全屏播放显示,如果需要做大小屏幕切换,请记得在这里耶设置上视频全屏的需要的自定义配置
//可参考super中的实现
return
sampleVideo
;
}
/**
* 弹出切换清晰度
*/
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYImageCover.java
浏览文件 @
15f9a3ba
package
com.shuyu.gsyvideoplayer
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.widget.ImageView
;
...
...
@@ -10,8 +11,14 @@ import com.shuyu.gsyvideoplayer.utils.GSYVideoType;
* Created by shuyu on 2016/12/6.
*/
@SuppressLint
(
"AppCompatCustomView"
)
public
class
GSYImageCover
extends
ImageView
{
private
boolean
fullView
;
private
int
originW
,
originH
;
public
GSYImageCover
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
}
...
...
@@ -37,8 +44,11 @@ public class GSYImageCover extends ImageView {
int
widthS
=
getDefaultSize
(
videoWidth
,
widthMeasureSpec
);
int
heightS
=
getDefaultSize
(
videoHeight
,
heightMeasureSpec
);
///Debuger.printfError("******** video size " + getRotation() + " " + videoHeight + " *****1 " + videoWidth);
//Debuger.printfError("******** widget size " + widthS + " *****2 " + heightS);
if
(
originW
==
0
||
originH
==
0
)
{
originW
=
widthS
;
originH
=
heightS
;
}
if
(
videoWidth
>
0
&&
videoHeight
>
0
)
{
int
widthSpecMode
=
MeasureSpec
.
getMode
(
widthMeasureSpec
);
...
...
@@ -83,9 +93,8 @@ public class GSYImageCover extends ImageView {
// no size yet, just adopt the given spec sizes
}
//Debuger.printfError("******** rotate before " + width + " *****3 " + height);
if
(
getRotation
()
!=
0
&&
getRotation
()
%
90
==
0
&&
Math
.
abs
(
getRotation
())
!=
180
)
{
boolean
rotate
=
(
getRotation
()
!=
0
&&
getRotation
()
%
90
==
0
&&
Math
.
abs
(
getRotation
())
!=
180
);
if
(
rotate
)
{
if
(
widthS
<
heightS
)
{
if
(
width
>
height
)
{
width
=
(
int
)
(
width
*
(
float
)
widthS
/
height
);
...
...
@@ -104,7 +113,6 @@ public class GSYImageCover extends ImageView {
}
}
//Debuger.printfError("******** real size before " + width + " *****3 " + height);
//如果旋转后的高度大于宽度
if
(
width
>
height
)
{
//如果视频的旋转后,width(高度)大于控件高度,需要压缩下高度
...
...
@@ -128,7 +136,6 @@ public class GSYImageCover extends ImageView {
}
}
//Debuger.printfError("******** real size " + width + " *****3 " + height);
//如果设置了比例
if
(
GSYVideoType
.
getShowType
()
==
GSYVideoType
.
SCREEN_TYPE_16_9
)
{
if
(
height
>
width
)
{
...
...
@@ -143,6 +150,50 @@ public class GSYImageCover extends ImageView {
height
=
width
*
3
/
4
;
}
}
fullView
=
(
GSYVideoType
.
getShowType
()
==
GSYVideoType
.
SCREEN_TYPE_FULL
);
//上面会调整一变全屏,这里如果要全屏裁减,就整另外一边
if
(
fullView
)
{
if
(
rotate
&&
getRotation
()
!=
0
)
{
if
(
width
>
height
)
{
if
(
height
<
originW
)
{
width
=
(
int
)
(
width
*
((
float
)
originW
/
height
));
height
=
originW
;
}
else
if
(
width
<
originH
)
{
height
=
(
int
)
(
height
*
((
float
)
originH
/
width
));
width
=
originH
;
}
}
else
{
if
(
width
<
originH
)
{
height
=
(
int
)
(
height
*
((
float
)
originH
/
width
));
width
=
originH
;
}
else
if
(
height
<
originW
)
{
width
=
(
int
)
(
width
*
((
float
)
originW
/
height
));
height
=
originW
;
}
}
}
else
{
if
(
height
>
width
)
{
if
(
width
<
widthS
)
{
height
=
(
int
)
(
height
*
((
float
)
widthS
/
width
));
width
=
widthS
;
}
else
{
width
=
(
int
)
(
width
*
((
float
)
heightS
/
height
));
height
=
heightS
;
}
}
else
{
if
(
height
<
heightS
)
{
width
=
(
int
)
(
width
*
((
float
)
heightS
/
height
));
height
=
heightS
;
}
else
{
height
=
(
int
)
(
height
*
((
float
)
widthS
/
width
));
width
=
widthS
;
}
}
}
}
setMeasuredDimension
(
width
,
height
);
}
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYTextureView.java
浏览文件 @
15f9a3ba
...
...
@@ -47,8 +47,6 @@ public class GSYTextureView extends TextureView {
originH
=
heightS
;
}
///Debuger.printfError("******** video size " + getRotation() + " " + videoHeight + " *****1 " + videoWidth);
//Debuger.printfError("******** widget size " + widthS + " *****2 " + heightS);
if
(
videoWidth
>
0
&&
videoHeight
>
0
)
{
int
widthSpecMode
=
MeasureSpec
.
getMode
(
widthMeasureSpec
);
...
...
@@ -93,7 +91,6 @@ public class GSYTextureView extends TextureView {
// no size yet, just adopt the given spec sizes
}
//Debuger.printfError("******** rotate before " + width + " *****3 " + height);
boolean
rotate
=
(
getRotation
()
!=
0
&&
getRotation
()
%
90
==
0
&&
Math
.
abs
(
getRotation
())
!=
180
);
if
(
rotate
)
{
if
(
widthS
<
heightS
)
{
...
...
@@ -114,7 +111,6 @@ public class GSYTextureView extends TextureView {
}
}
//Debuger.printfError("******** real size before " + width + " *****3 " + height);
//如果旋转后的高度大于宽度
if
(
width
>
height
)
{
//如果视频的旋转后,width(高度)大于控件高度,需要压缩下高度
...
...
@@ -138,7 +134,6 @@ public class GSYTextureView extends TextureView {
}
}
//Debuger.printfError("******** real size " + width + " *****3 " + height);
//如果设置了比例
if
(
GSYVideoType
.
getShowType
()
==
GSYVideoType
.
SCREEN_TYPE_16_9
)
{
if
(
height
>
width
)
{
...
...
@@ -154,8 +149,10 @@ public class GSYTextureView extends TextureView {
}
}
fullView
=
(
GSYVideoType
.
getShowType
()
==
GSYVideoType
.
SCREEN_TYPE_FULL
);
//上面会调整一变全屏,这里如果要全屏裁减,就整另外一边
if
(
true
)
{
if
(
fullView
)
{
if
(
rotate
&&
getRotation
()
!=
0
)
{
if
(
width
>
height
)
{
if
(
height
<
originW
)
{
...
...
@@ -209,12 +206,4 @@ public class GSYTextureView extends TextureView {
public
int
getSizeW
()
{
return
sizeW
;
}
public
boolean
isFullView
()
{
return
fullView
;
}
public
void
setFullView
(
boolean
fullView
)
{
this
.
fullView
=
fullView
;
}
}
\ No newline at end of file
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/utils/GSYVideoType.java
浏览文件 @
15f9a3ba
...
...
@@ -15,6 +15,9 @@ public class GSYVideoType {
//4:3
public
final
static
int
SCREEN_TYPE_4_3
=
2
;
//全屏裁减显示
public
final
static
int
SCREEN_TYPE_FULL
=
4
;
public
final
static
int
IJKPLAYER
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录