提交 48613980 编写于 作者: G guoshuyu

add Pause flag Before Prepared

上级 65c40b13
......@@ -121,7 +121,7 @@ compile 'com.shuyu:gsyVideoPlayer-ex_so:2.1.1'
## 五、近期版本
### 2.1.2(2017-xx-xx 未发布)
* 增加针对Prepared之前调用OnVideoPause的处理
* 背景视频模糊铺满,前方视频正常播放
```
DetailFilterActivity中注释的
......
......@@ -87,9 +87,6 @@ public abstract class GSYVideoView extends GSYTextureRenderView implements GSYMe
//从哪个开始播放
protected long mSeekOnStart = -1;
//保存暂停时的时间
protected long mPauseTime;
//当前的播放位置
protected long mCurrentPosition;
......@@ -123,6 +120,9 @@ public abstract class GSYVideoView extends GSYTextureRenderView implements GSYMe
//是否需要显示暂停锁定效果
protected boolean mShowPauseCover = true;
//是否准备完成前调用了暂停
protected boolean mPauseBeforePrepared = false;
//音频焦点的监听
protected AudioManager mAudioManager;
......@@ -411,11 +411,13 @@ public abstract class GSYVideoView extends GSYTextureRenderView implements GSYMe
*/
@Override
public void onVideoPause() {
if (mCurrentState == CURRENT_STATE_PREPAREING) {
mPauseBeforePrepared = true;
}
try {
if (GSYVideoManager.instance().getMediaPlayer() != null &&
GSYVideoManager.instance().getMediaPlayer().isPlaying()) {
setStateAndUi(CURRENT_STATE_PAUSE);
mPauseTime = System.currentTimeMillis();
mCurrentPosition = GSYVideoManager.instance().getMediaPlayer().getCurrentPosition();
if (GSYVideoManager.instance().getMediaPlayer() != null)
GSYVideoManager.instance().getMediaPlayer().pause();
......@@ -430,7 +432,7 @@ public abstract class GSYVideoView extends GSYTextureRenderView implements GSYMe
*/
@Override
public void onVideoResume() {
mPauseTime = 0;
mPauseBeforePrepared = false;
if (mCurrentState == CURRENT_STATE_PAUSE) {
try {
if (mCurrentPosition > 0 && GSYVideoManager.instance().getMediaPlayer() != null) {
......@@ -507,6 +509,11 @@ public abstract class GSYVideoView extends GSYTextureRenderView implements GSYMe
if (mTextureView != null) {
mTextureView.onResume();
}
if (mPauseBeforePrepared) {
onVideoPause();
mPauseBeforePrepared = false;
}
}
@Override
......@@ -657,7 +664,7 @@ public abstract class GSYVideoView extends GSYTextureRenderView implements GSYMe
}
}
if (position == 0 && mCurrentPosition > 0) {
return (int)mCurrentPosition;
return (int) mCurrentPosition;
}
return position;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册