上一篇:
下一篇:https://www.jianshu.com/p/029cd006e580
PlayerBase框架
git地址:https://github.com/jiajunhui/PlayerBase
详细资料:
https://github.com/jiajunhui/PlayerBase/wiki
https://juejin.im/post/5b0d4e6bf265da090f7376d2
目录:
PlayerBase.pngPlayerBase结构
BaseVideoView内部主要包含两个部分:(1)播放器内核AVPlayer;(2)视图容器Supercontainer。
VideoView.png
主要接口与关系
1、IVideoView:播放器接口
2、IPlayer:播放器内核接口
3、SuperContainer:容器类
4、IRender:渲染器接口
5、IReceiverGroup:事件接收器组接口
6、IProducerGroup:外部事件生成器组接口
7、IEventDispatcher:事件分发器接口
1、接口IVideoView的实现类BaseVideoView内含有AVPlayer和SuperContainer
public class BaseVideoView extends FrameLayout implements IVideoView, IStyleSetter {
final String TAG = "BaseVideoView";
// 播放器内核
private AVPlayer mPlayer;
// 所有播放视图的容器,包含所有覆盖层
private SuperContainer mSuperContainer;
}
2、接口IPlayer
public final class AVPlayer implements IPlayer{
private BaseInternalPlayer mInternalPlayer;
}
public abstract class BaseInternalPlayer implements IPlayer {
-> public class IjkPlayer extends BaseInternalPlayer {
-> public class ExoMediaPlayer extends BaseInternalPlayer {
-> public class SysMediaPlayer extends BaseInternalPlayer {
public interface IPlayer {}
3、SuperContainer超容器类内含接收组和事件监听
public class SuperContainer extends FrameLayout implements OnTouchGestureListener {
private IReceiverGroup mReceiverGroup;
}
4、接口IRender的实现类有SurfaceView和TextureView
public class RenderSurfaceView extends SurfaceView implements IRender {
public class RenderTextureView extends TextureView implements IRender {
5、接口IReceiverGroup用于统一管理IReceiver,内含有IReceiver和ICover
public interface IReceiverGroup {
//添加一个Receiver,你需要指定一个唯一的key值对应于Receiver。
void addReceiver(String key, IReceiver receiver);
}
6、接口IProducerGroup用于统一管理外部事件BaseEventProducer
public interface IProducerGroup {
//添加一个BaseEventProducer
void addEventProducer(BaseEventProducer eventProducer);
}
7、接口IEventDispatcher用于事件分发
public interface IEventDispatcher { }
接口关系图.png
网友评论