Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NotesChapter
GSYVideoPlayer
提交
5a560601
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,发现更多精彩内容 >>
提交
5a560601
编写于
12月 23, 2019
作者:
G
guoshuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#2480
上级
5e5ae182
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
70 addition
and
19 deletion
+70
-19
app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java
...rc/main/java/com/example/gsyvideoplayer/DetailPlayer.java
+5
-0
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/builder/GSYVideoOptionBuilder.java
...m/shuyu/gsyvideoplayer/builder/GSYVideoOptionBuilder.java
+10
-0
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/utils/OrientationUtils.java
...java/com/shuyu/gsyvideoplayer/utils/OrientationUtils.java
+28
-11
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYBaseVideoPlayer.java
...m/shuyu/gsyvideoplayer/video/base/GSYBaseVideoPlayer.java
+19
-0
gsyVideoPlayer/build.gradle
gsyVideoPlayer/build.gradle
+8
-8
未找到文件。
app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java
浏览文件 @
5a560601
...
...
@@ -97,6 +97,9 @@ public class DetailPlayer extends AppCompatActivity {
//初始化不打开外部的旋转
orientationUtils
.
setEnable
(
false
);
/**仅仅横屏旋转,不变直*/
orientationUtils
.
setOnlyRotateLand
(
true
);
Map
<
String
,
String
>
header
=
new
HashMap
<>();
header
.
put
(
"ee"
,
"33"
);
header
.
put
(
"allowCrossProtocolRedirects"
,
"true"
);
...
...
@@ -104,6 +107,8 @@ public class DetailPlayer extends AppCompatActivity {
gsyVideoOption
.
setThumbImageView
(
imageView
)
.
setIsTouchWiget
(
true
)
.
setRotateViewAuto
(
false
)
//仅仅横屏旋转,不变直
.
setOnlyRotateLand
(
true
)
.
setLockLand
(
false
)
.
setAutoFullWithSize
(
false
)
.
setShowFullAnimation
(
false
)
...
...
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/builder/GSYVideoOptionBuilder.java
浏览文件 @
5a560601
...
...
@@ -125,6 +125,8 @@ public class GSYVideoOptionBuilder {
// 是否需要覆盖拓展类型
protected
String
mOverrideExtension
;
private
boolean
mIsOnlyRotateLand
=
false
;
//是否自定义的缓冲文件路径
protected
File
mCachePath
;
...
...
@@ -539,6 +541,13 @@ public class GSYVideoOptionBuilder {
return
this
;
}
public
GSYVideoOptionBuilder
setOnlyRotateLand
(
boolean
onlyRotateLand
)
{
this
.
mIsOnlyRotateLand
=
onlyRotateLand
;
return
this
;
}
/**
* 在播放前才真正执行setup
* 目前弃用,请使用正常setup
...
...
@@ -615,6 +624,7 @@ public class GSYVideoOptionBuilder {
gsyVideoPlayer
.
setOverrideExtension
(
mOverrideExtension
);
gsyVideoPlayer
.
setAutoFullWithSize
(
mAutoFullWithSize
);
gsyVideoPlayer
.
setRotateViewAuto
(
mRotateViewAuto
);
gsyVideoPlayer
.
setOnlyRotateLand
(
mIsOnlyRotateLand
);
gsyVideoPlayer
.
setLockLand
(
mLockLand
);
gsyVideoPlayer
.
setSpeed
(
mSpeed
,
mSounchTouch
);
gsyVideoPlayer
.
setHideKey
(
mHideKey
);
...
...
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/utils/OrientationUtils.java
浏览文件 @
5a560601
...
...
@@ -34,6 +34,8 @@ public class OrientationUtils {
private
boolean
mIsPause
=
false
;
private
boolean
mIsOnlyRotateLand
=
false
;
/**
* @param activity
* @param gsyVideoPlayer
...
...
@@ -44,13 +46,15 @@ public class OrientationUtils {
init
();
}
pr
ivate
void
init
()
{
pr
otected
void
init
()
{
mOrientationEventListener
=
new
OrientationEventListener
(
mActivity
.
getApplicationContext
())
{
@Override
public
void
onOrientationChanged
(
int
rotation
)
{
boolean
autoRotateOn
=
(
Settings
.
System
.
getInt
(
mActivity
.
getContentResolver
(),
Settings
.
System
.
ACCELEROMETER_ROTATION
,
0
)
==
1
);
if
(!
autoRotateOn
&&
mRotateWithSystem
)
{
return
;
if
(!
mIsOnlyRotateLand
||
getIsLand
()
==
LAND_TYPE_NULL
)
{
return
;
}
}
if
(
mVideoPlayer
!=
null
&&
mVideoPlayer
.
isVerticalFullByVideoSize
())
{
return
;
...
...
@@ -70,16 +74,18 @@ public class OrientationUtils {
}
}
else
{
if
(
mIsLand
>
LAND_TYPE_NULL
)
{
mScreenType
=
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
;
mActivity
.
setRequestedOrientation
(
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
);
if
(
mVideoPlayer
.
getFullscreenButton
()
!=
null
)
{
if
(
mVideoPlayer
.
isIfCurrentIsFullscreen
())
{
mVideoPlayer
.
getFullscreenButton
().
setImageResource
(
mVideoPlayer
.
getShrinkImageRes
());
}
else
{
mVideoPlayer
.
getFullscreenButton
().
setImageResource
(
mVideoPlayer
.
getEnlargeImageRes
());
if
(!
mIsOnlyRotateLand
)
{
mScreenType
=
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
;
mActivity
.
setRequestedOrientation
(
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
);
if
(
mVideoPlayer
.
getFullscreenButton
()
!=
null
)
{
if
(
mVideoPlayer
.
isIfCurrentIsFullscreen
())
{
mVideoPlayer
.
getFullscreenButton
().
setImageResource
(
mVideoPlayer
.
getShrinkImageRes
());
}
else
{
mVideoPlayer
.
getFullscreenButton
().
setImageResource
(
mVideoPlayer
.
getEnlargeImageRes
());
}
}
mIsLand
=
LAND_TYPE_NULL
;
}
mIsLand
=
LAND_TYPE_NULL
;
mClick
=
false
;
}
}
...
...
@@ -141,7 +147,7 @@ public class OrientationUtils {
mClick
=
true
;
if
(
mIsLand
==
LAND_TYPE_NULL
)
{
int
request
=
mActivity
.
getRequestedOrientation
();
if
(
request
==
ActivityInfo
.
SCREEN_ORIENTATION_REVERSE_LANDSCAPE
)
{
if
(
request
==
ActivityInfo
.
SCREEN_ORIENTATION_REVERSE_LANDSCAPE
)
{
mScreenType
=
ActivityInfo
.
SCREEN_ORIENTATION_REVERSE_LANDSCAPE
;
}
else
{
mScreenType
=
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
;
...
...
@@ -250,6 +256,17 @@ public class OrientationUtils {
return
mRotateWithSystem
;
}
public
boolean
isOnlyRotateLand
()
{
return
mIsOnlyRotateLand
;
}
/**
* 旋转时仅处理横屏
*/
public
void
setOnlyRotateLand
(
boolean
onlyRotateLand
)
{
this
.
mIsOnlyRotateLand
=
onlyRotateLand
;
}
/**
* 是否更新系统旋转,false的话,系统禁止旋转也会跟着旋转
*
...
...
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYBaseVideoPlayer.java
浏览文件 @
5a560601
...
...
@@ -81,6 +81,7 @@ public abstract class GSYBaseVideoPlayer extends GSYVideoControlView {
//旋转工具类
protected
OrientationUtils
mOrientationUtils
;
private
boolean
mIsOnlyRotateLand
=
false
;
//全屏返回监听,如果设置了,默认返回无效
protected
View
.
OnClickListener
mBackFromFullScreenListener
;
protected
Handler
mInnerHandler
=
new
Handler
();
...
...
@@ -313,6 +314,7 @@ public abstract class GSYBaseVideoPlayer extends GSYVideoControlView {
mOrientationUtils
=
new
OrientationUtils
((
Activity
)
context
,
gsyVideoPlayer
);
mOrientationUtils
.
setEnable
(
isRotateViewAuto
());
mOrientationUtils
.
setRotateWithSystem
(
mRotateWithSystem
);
mOrientationUtils
.
setOnlyRotateLand
(
mIsOnlyRotateLand
);
gsyVideoPlayer
.
mOrientationUtils
=
mOrientationUtils
;
final
boolean
isVertical
=
isVerticalFullByVideoSize
();
...
...
@@ -865,6 +867,9 @@ public abstract class GSYBaseVideoPlayer extends GSYVideoControlView {
*/
public
void
setRotateWithSystem
(
boolean
rotateWithSystem
)
{
this
.
mRotateWithSystem
=
rotateWithSystem
;
if
(
mOrientationUtils
!=
null
)
{
mOrientationUtils
.
setRotateWithSystem
(
rotateWithSystem
);
}
}
/**
...
...
@@ -971,6 +976,20 @@ public abstract class GSYBaseVideoPlayer extends GSYVideoControlView {
isNeedAutoAdaptation
=
needAutoAdaptation
;
}
public
boolean
isOnlyRotateLand
()
{
return
mIsOnlyRotateLand
;
}
/**
* 旋转时仅处理横屏
*/
public
void
setOnlyRotateLand
(
boolean
onlyRotateLand
)
{
this
.
mIsOnlyRotateLand
=
onlyRotateLand
;
if
(
mOrientationUtils
!=
null
)
{
mOrientationUtils
.
setOnlyRotateLand
(
mIsOnlyRotateLand
);
}
}
/**
* 检测是否根据视频尺寸,自动选择竖屏全屏或者横屏全屏;
* 并且适配在竖屏横屏时,由于刘海屏或者打孔屏占据空间,导致标题显示被遮盖的问题
...
...
gsyVideoPlayer/build.gradle
浏览文件 @
5a560601
...
...
@@ -35,7 +35,7 @@ android {
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
//
api project(':gsyVideoPlayer-java')
api
project
(
':gsyVideoPlayer-java'
)
//api project(':gsyVideoPlayer-exo_player2')
//api project(':gsyVideoPlayer-armv5')
//api project(':gsyVideoPlayer-armv7a')
...
...
@@ -48,16 +48,16 @@ dependencies {
//api "com.shuyu:GSYVideoPlayer:$gsyVideoVersion"
api
"com.shuyu:gsyVideoPlayer-java:$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"
api
"com.shuyu:gsyVideoPlayer-ex_so:$gsyVideoVersion"
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录