提交 e253daca 编写于 作者: G guoshuyu

增加 GSYStateUiListener

上级 0782cc5c
......@@ -3,6 +3,7 @@ package com.shuyu.gsyvideoplayer.builder;
import android.graphics.drawable.Drawable;
import android.view.View;
import com.shuyu.gsyvideoplayer.listener.GSYStateUiListener;
import com.shuyu.gsyvideoplayer.listener.GSYVideoProgressListener;
import com.shuyu.gsyvideoplayer.render.view.GSYVideoGLView;
import com.shuyu.gsyvideoplayer.render.effect.NoEffect;
......@@ -160,6 +161,9 @@ public class GSYVideoOptionBuilder {
//滑动dialog进度条样式
protected Drawable mDialogProgressBarDrawable;
///状态监听
protected GSYStateUiListener mGSYStateUiListener;
//滤镜
protected GSYVideoGLView.ShaderInterface mEffectFilter = new NoEffect();
......@@ -537,6 +541,7 @@ public class GSYVideoOptionBuilder {
/**
* 是否需要覆盖拓展类型,目前只针对exoPlayer内核模式有效
*
* @param overrideExtension 比如传入 m3u8,mp4,avi 等类型
*/
public GSYVideoOptionBuilder setOverrideExtension(String overrideExtension) {
......@@ -575,6 +580,14 @@ public class GSYVideoOptionBuilder {
return this;
}
/***
* 状态监听
*/
public GSYVideoOptionBuilder setGSYStateUiListener(GSYStateUiListener gsyStateUiListener) {
this.mGSYStateUiListener = gsyStateUiListener;
return this;
}
public void build(StandardGSYVideoPlayer gsyVideoPlayer) {
if (mBottomShowProgressDrawable != null && mBottomShowProgressThumbDrawable != null) {
gsyVideoPlayer.setBottomShowProgressBarDrawable(mBottomShowProgressDrawable, mBottomShowProgressThumbDrawable);
......@@ -628,6 +641,9 @@ public class GSYVideoOptionBuilder {
if (mGSYVideoProgressListener != null) {
gsyVideoPlayer.setGSYVideoProgressListener(mGSYVideoProgressListener);
}
if (mGSYStateUiListener != null) {
gsyVideoPlayer.setGSYStateUiListener(mGSYStateUiListener);
}
gsyVideoPlayer.setOverrideExtension(mOverrideExtension);
gsyVideoPlayer.setAutoFullWithSize(mAutoFullWithSize);
gsyVideoPlayer.setRotateViewAuto(mRotateViewAuto);
......
package com.shuyu.gsyvideoplayer.listener;
/**
* 状态变化监听
*/
public interface GSYStateUiListener {
void onStateChanged(int state);
}
......@@ -25,6 +25,7 @@ import android.widget.SeekBar;
import android.widget.TextView;
import com.shuyu.gsyvideoplayer.R;
import com.shuyu.gsyvideoplayer.listener.GSYStateUiListener;
import com.shuyu.gsyvideoplayer.listener.GSYVideoProgressListener;
import com.shuyu.gsyvideoplayer.listener.LockClickListener;
import com.shuyu.gsyvideoplayer.utils.CommonUtil;
......@@ -173,6 +174,8 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
//点击锁屏的回调
protected LockClickListener mLockClickListener;
protected GSYStateUiListener mGsyStateUiListener;
protected GSYVideoProgressListener mGSYVideoProgressListener;
public GSYVideoControlView(@NonNull Context context) {
......@@ -361,6 +364,9 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
break;
}
resolveUIState(state);
if (mGsyStateUiListener != null) {
mGsyStateUiListener.onStateChanged(state);
}
}
......@@ -1374,4 +1380,15 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
public void setShowDragProgressTextOnSeekBar(boolean showDragProgressTextOnSeekBar) {
isShowDragProgressTextOnSeekBar = showDragProgressTextOnSeekBar;
}
/***
* 状态监听
*/
public GSYStateUiListener getGSYStateUiListener() {
return mGsyStateUiListener;
}
public void setGSYStateUiListener(GSYStateUiListener gsyStateUiListener) {
this.mGsyStateUiListener = gsyStateUiListener;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册