Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_26386469
GSYVideoPlayer
提交
cd81bf8b
G
GSYVideoPlayer
项目概览
qq_26386469
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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 搜索 >>
提交
cd81bf8b
编写于
8月 05, 2017
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整了代码结构 (2017-08-05)
上级
9e9c6b44
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
111 addition
and
91 deletion
+111
-91
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoControlView.java
.../shuyu/gsyvideoplayer/video/base/GSYVideoControlView.java
+111
-91
未找到文件。
gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYVideoControlView.java
浏览文件 @
cd81bf8b
...
...
@@ -392,6 +392,8 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
float
y
=
event
.
getY
();
if
(
mIfCurrentIsFullscreen
&&
mLockCurScreen
&&
mNeedLockFull
)
{
onClickUiToggle
();
startDismissControlViewTimer
();
return
true
;
}
...
...
@@ -402,15 +404,8 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
if
(
id
==
R
.
id
.
surface_container
)
{
switch
(
event
.
getAction
())
{
case
MotionEvent
.
ACTION_DOWN
:
mTouchingProgressBar
=
true
;
mDownX
=
x
;
mDownY
=
y
;
mMoveY
=
0
;
mChangeVolume
=
false
;
mChangePosition
=
false
;
mShowVKey
=
false
;
mBrightness
=
false
;
mFirstTouch
=
true
;
touchSurfaceDown
(
x
,
y
);
break
;
case
MotionEvent
.
ACTION_MOVE
:
...
...
@@ -422,97 +417,18 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
if
((
mIfCurrentIsFullscreen
&&
mIsTouchWigetFull
)
||
(
mIsTouchWiget
&&
!
mIfCurrentIsFullscreen
))
{
if
(!
mChangePosition
&&
!
mChangeVolume
&&
!
mBrightness
)
{
if
(
absDeltaX
>
mThreshold
||
absDeltaY
>
mThreshold
)
{
cancelProgressTimer
();
if
(
absDeltaX
>=
mThreshold
)
{
//防止全屏虚拟按键
int
screenWidth
=
CommonUtil
.
getScreenWidth
(
getContext
());
if
(
Math
.
abs
(
screenWidth
-
mDownX
)
>
mSeekEndOffset
)
{
mChangePosition
=
true
;
mDownPosition
=
getCurrentPositionWhenPlaying
();
}
else
{
mShowVKey
=
true
;
}
}
else
{
int
screenHeight
=
CommonUtil
.
getScreenHeight
(
getContext
());
boolean
noEnd
=
Math
.
abs
(
screenHeight
-
mDownY
)
>
mSeekEndOffset
;
if
(
mFirstTouch
)
{
mBrightness
=
(
mDownX
<
mScreenWidth
*
0.5f
)
&&
noEnd
;
mFirstTouch
=
false
;
}
if
(!
mBrightness
)
{
mChangeVolume
=
noEnd
;
mGestureDownVolume
=
mAudioManager
.
getStreamVolume
(
AudioManager
.
STREAM_MUSIC
);
}
mShowVKey
=
!
noEnd
;
}
}
}
}
if
(
mChangePosition
)
{
int
totalTimeDuration
=
getDuration
();
mSeekTimePosition
=
(
int
)
(
mDownPosition
+
(
deltaX
*
totalTimeDuration
/
mScreenWidth
)
/
mSeekRatio
);
if
(
mSeekTimePosition
>
totalTimeDuration
)
mSeekTimePosition
=
totalTimeDuration
;
String
seekTime
=
CommonUtil
.
stringForTime
(
mSeekTimePosition
);
String
totalTime
=
CommonUtil
.
stringForTime
(
totalTimeDuration
);
showProgressDialog
(
deltaX
,
seekTime
,
mSeekTimePosition
,
totalTime
,
totalTimeDuration
);
}
else
if
(
mChangeVolume
)
{
deltaY
=
-
deltaY
;
int
max
=
mAudioManager
.
getStreamMaxVolume
(
AudioManager
.
STREAM_MUSIC
);
int
deltaV
=
(
int
)
(
max
*
deltaY
*
3
/
mScreenHeight
);
mAudioManager
.
setStreamVolume
(
AudioManager
.
STREAM_MUSIC
,
mGestureDownVolume
+
deltaV
,
0
);
int
volumePercent
=
(
int
)
(
mGestureDownVolume
*
100
/
max
+
deltaY
*
3
*
100
/
mScreenHeight
);
showVolumeDialog
(-
deltaY
,
volumePercent
);
}
else
if
(!
mChangePosition
&&
mBrightness
)
{
if
(
Math
.
abs
(
deltaY
)
>
mThreshold
)
{
float
percent
=
(-
deltaY
/
mScreenHeight
);
onBrightnessSlide
(
percent
);
mDownY
=
y
;
touchSurfaceMoveFullLogic
(
absDeltaX
,
absDeltaY
);
}
}
touchSurfaceMove
(
deltaX
,
deltaY
,
y
);
break
;
case
MotionEvent
.
ACTION_UP
:
startDismissControlViewTimer
();
if
(
mChangePosition
)
{
int
duration
=
getDuration
();
int
progress
=
mSeekTimePosition
*
100
/
(
duration
==
0
?
1
:
duration
);
mBottomProgressBar
.
setProgress
(
progress
);
}
if
(!
mChangePosition
&&
!
mChangeVolume
&&
!
mBrightness
)
{
onClickUiToggle
();
}
touchSurfaceUp
();
mTouchingProgressBar
=
false
;
dismissProgressDialog
();
dismissVolumeDialog
();
dismissBrightnessDialog
();
if
(
mChangePosition
&&
GSYVideoManager
.
instance
().
getMediaPlayer
()
!=
null
&&
(
mCurrentState
==
CURRENT_STATE_PLAYING
||
mCurrentState
==
CURRENT_STATE_PAUSE
))
{
GSYVideoManager
.
instance
().
getMediaPlayer
().
seekTo
(
mSeekTimePosition
);
int
duration
=
getDuration
();
int
progress
=
mSeekTimePosition
*
100
/
(
duration
==
0
?
1
:
duration
);
if
(
mProgressBar
!=
null
)
{
mProgressBar
.
setProgress
(
progress
);
}
if
(
mVideoAllCallBack
!=
null
&&
isCurrentMediaListener
())
{
Debuger
.
printfLog
(
"onTouchScreenSeekPosition"
);
mVideoAllCallBack
.
onTouchScreenSeekPosition
(
mOriginUrl
,
mTitle
,
this
);
}
}
else
if
(
mBrightness
)
{
if
(
mVideoAllCallBack
!=
null
&&
isCurrentMediaListener
())
{
Debuger
.
printfLog
(
"onTouchScreenSeekLight"
);
mVideoAllCallBack
.
onTouchScreenSeekLight
(
mOriginUrl
,
mTitle
,
this
);
}
}
else
if
(
mChangeVolume
)
{
if
(
mVideoAllCallBack
!=
null
&&
isCurrentMediaListener
())
{
Debuger
.
printfLog
(
"onTouchScreenSeekVolume"
);
mVideoAllCallBack
.
onTouchScreenSeekVolume
(
mOriginUrl
,
mTitle
,
this
);
}
}
startProgressTimer
();
//不要和隐藏虚拟按键后,滑出虚拟按键冲突
if
(
mHideKey
&&
mShowVKey
)
{
...
...
@@ -548,6 +464,110 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
return
false
;
}
protected
void
touchSurfaceDown
(
float
x
,
float
y
)
{
mTouchingProgressBar
=
true
;
mDownX
=
x
;
mDownY
=
y
;
mMoveY
=
0
;
mChangeVolume
=
false
;
mChangePosition
=
false
;
mShowVKey
=
false
;
mBrightness
=
false
;
mFirstTouch
=
true
;
}
protected
void
touchSurfaceMove
(
float
deltaX
,
float
deltaY
,
float
y
)
{
if
(
mChangePosition
)
{
int
totalTimeDuration
=
getDuration
();
mSeekTimePosition
=
(
int
)
(
mDownPosition
+
(
deltaX
*
totalTimeDuration
/
mScreenWidth
)
/
mSeekRatio
);
if
(
mSeekTimePosition
>
totalTimeDuration
)
mSeekTimePosition
=
totalTimeDuration
;
String
seekTime
=
CommonUtil
.
stringForTime
(
mSeekTimePosition
);
String
totalTime
=
CommonUtil
.
stringForTime
(
totalTimeDuration
);
showProgressDialog
(
deltaX
,
seekTime
,
mSeekTimePosition
,
totalTime
,
totalTimeDuration
);
}
else
if
(
mChangeVolume
)
{
deltaY
=
-
deltaY
;
int
max
=
mAudioManager
.
getStreamMaxVolume
(
AudioManager
.
STREAM_MUSIC
);
int
deltaV
=
(
int
)
(
max
*
deltaY
*
3
/
mScreenHeight
);
mAudioManager
.
setStreamVolume
(
AudioManager
.
STREAM_MUSIC
,
mGestureDownVolume
+
deltaV
,
0
);
int
volumePercent
=
(
int
)
(
mGestureDownVolume
*
100
/
max
+
deltaY
*
3
*
100
/
mScreenHeight
);
showVolumeDialog
(-
deltaY
,
volumePercent
);
}
else
if
(!
mChangePosition
&&
mBrightness
)
{
if
(
Math
.
abs
(
deltaY
)
>
mThreshold
)
{
float
percent
=
(-
deltaY
/
mScreenHeight
);
onBrightnessSlide
(
percent
);
mDownY
=
y
;
}
}
}
protected
void
touchSurfaceMoveFullLogic
(
float
absDeltaX
,
float
absDeltaY
)
{
if
(
absDeltaX
>
mThreshold
||
absDeltaY
>
mThreshold
)
{
cancelProgressTimer
();
if
(
absDeltaX
>=
mThreshold
)
{
//防止全屏虚拟按键
int
screenWidth
=
CommonUtil
.
getScreenWidth
(
getContext
());
if
(
Math
.
abs
(
screenWidth
-
mDownX
)
>
mSeekEndOffset
)
{
mChangePosition
=
true
;
mDownPosition
=
getCurrentPositionWhenPlaying
();
}
else
{
mShowVKey
=
true
;
}
}
else
{
int
screenHeight
=
CommonUtil
.
getScreenHeight
(
getContext
());
boolean
noEnd
=
Math
.
abs
(
screenHeight
-
mDownY
)
>
mSeekEndOffset
;
if
(
mFirstTouch
)
{
mBrightness
=
(
mDownX
<
mScreenWidth
*
0.5f
)
&&
noEnd
;
mFirstTouch
=
false
;
}
if
(!
mBrightness
)
{
mChangeVolume
=
noEnd
;
mGestureDownVolume
=
mAudioManager
.
getStreamVolume
(
AudioManager
.
STREAM_MUSIC
);
}
mShowVKey
=
!
noEnd
;
}
}
}
protected
void
touchSurfaceUp
()
{
if
(
mChangePosition
)
{
int
duration
=
getDuration
();
int
progress
=
mSeekTimePosition
*
100
/
(
duration
==
0
?
1
:
duration
);
mBottomProgressBar
.
setProgress
(
progress
);
}
if
(!
mChangePosition
&&
!
mChangeVolume
&&
!
mBrightness
)
{
onClickUiToggle
();
}
mTouchingProgressBar
=
false
;
dismissProgressDialog
();
dismissVolumeDialog
();
dismissBrightnessDialog
();
if
(
mChangePosition
&&
GSYVideoManager
.
instance
().
getMediaPlayer
()
!=
null
&&
(
mCurrentState
==
CURRENT_STATE_PLAYING
||
mCurrentState
==
CURRENT_STATE_PAUSE
))
{
GSYVideoManager
.
instance
().
getMediaPlayer
().
seekTo
(
mSeekTimePosition
);
int
duration
=
getDuration
();
int
progress
=
mSeekTimePosition
*
100
/
(
duration
==
0
?
1
:
duration
);
if
(
mProgressBar
!=
null
)
{
mProgressBar
.
setProgress
(
progress
);
}
if
(
mVideoAllCallBack
!=
null
&&
isCurrentMediaListener
())
{
Debuger
.
printfLog
(
"onTouchScreenSeekPosition"
);
mVideoAllCallBack
.
onTouchScreenSeekPosition
(
mOriginUrl
,
mTitle
,
this
);
}
}
else
if
(
mBrightness
)
{
if
(
mVideoAllCallBack
!=
null
&&
isCurrentMediaListener
())
{
Debuger
.
printfLog
(
"onTouchScreenSeekLight"
);
mVideoAllCallBack
.
onTouchScreenSeekLight
(
mOriginUrl
,
mTitle
,
this
);
}
}
else
if
(
mChangeVolume
)
{
if
(
mVideoAllCallBack
!=
null
&&
isCurrentMediaListener
())
{
Debuger
.
printfLog
(
"onTouchScreenSeekVolume"
);
mVideoAllCallBack
.
onTouchScreenSeekVolume
(
mOriginUrl
,
mTitle
,
this
);
}
}
}
@Override
protected
void
setSmallVideoTextureView
(
View
.
OnTouchListener
onTouchListener
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录