jiajunhui / PlayerBase

The basic library of Android player will process complex business components. The access is simple。Android播放器基础库,专注于播放视图组件的高复用性和组件间的低耦合,轻松处理复杂业务。
Apache License 2.0
2.92k stars 438 forks source link

添加了ControllerCover但是却不能控制进度? #60

Closed tmxd09887 closed 5 years ago

tmxd09887 commented 5 years ago

版本 'cn.jiajunhui:exoplayer:3332_291_004'

`
receiverGroup = new ReceiverGroup();

receiverGroup.addReceiver(KEY_LOADING_COVER, new LoadingCover(context));

receiverGroup.addReceiver(KEY_CONTROLLER_COVER, new ControllerCover(context));

receiverGroup.addReceiver(KEY_GESTURE_COVER, new GestureCover(context));

receiverGroup.addReceiver(KEY_COMPLETE_COVER, new CompleteCover(context));

receiverGroup.addReceiver(KEY_ERROR_COVER, new ErrorCover(context));

mVideoView.setReceiverGroup(receiverGroup);

mVideoView.setDataSource(new DataSource("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4"));

mVideoView.start();`

不能控制进度,也不能暂停,controller基本是无效的,但是设置的手势和LOADING却正常。

基本跟DEMO一样,不知道是哪里错了?

jiajunhui commented 5 years ago

@tmxd09887 mVideoView.setEventHandler(new OnVideoViewEventHandler());

tmxd09887 commented 5 years ago

感谢,进度条解决了,但是有新的问题

缩放按钮(图标)点了无效,返回箭头(图标)也点了无效

_20181122140608

看了跟DEMO也一样啊

jiajunhui commented 5 years ago

@tmxd09887 只有播放、暂停、快进、重播、停止这些操作,框架会自行通过EventHandler处理,其他事件(比如返回、半全屏切换这些是与当前Activity页面紧密相关的操作,框架不会处理)需要自己自行处理。设置EventHandler时可以按如下操作:

mVideoView.setEventHandler(new OnVideoViewEventHandler(){
        @Override
        public void onAssistHandle(BaseVideoView assist, int eventCode, Bundle bundle) {
            //super内部其实就是在处理 播放、暂停、快进、重播、停止这些操作
            super.onAssistHandle(assist, eventCode, bundle);
            //其余的code为自定义code,具体操作自己处理
            switch (eventCode){
                case DataInter.Event.EVENT_CODE_REQUEST_BACK:

                    break;
                case DataInter.Event.EVENT_CODE_REQUEST_TOGGLE_SCREEN:

                    break;
                //....
            }
        }
    });

请仔细阅读demo,完整的用法,demo中都有体现。

tmxd09887 commented 5 years ago

学习中

感谢