Android VideoView MediaPlayer OnInfoListener - events not fired

后端 未结 7 1265
借酒劲吻你
借酒劲吻你 2021-01-12 04:51

this following source code snippet is given:

videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onP         


        
7条回答
  •  再見小時候
    2021-01-12 05:50

    I know its too late, But posting it for the users still seeking for the solution (This worked for me):

            progressDialog.show();
            videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mediaPlayer) {
                    mediaPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() {
                        @Override
                        public boolean onInfo(MediaPlayer mp, int what, int extra) {
                            if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END){
                                progressDialog.dismiss();
                                return true;
                            } else if(what == MediaPlayer.MEDIA_INFO_BUFFERING_START){
                                progressDialog.show();
                            }
                            return false;
                        }
                    });
                    progressDialog.dismiss();
                    videoView.start();
                }
            });
    

提交回复
热议问题