Android VideoView MediaPlayer OnInfoListener - events not fired

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

this following source code snippet is given:

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


        
7条回答
  •  萌比男神i
    2021-01-12 05:36

    onPrepared is called when the MediaPlayer is prepared to start buffering, not when the video is completely buffered. However, it is completely natural to dismiss the loading dialog from within the onPrepared method.

    Also MEDIA_INFO_BUFFERING_END is used when MediaPlayer is resuming playback after filling buffers, so I do not think it should be something to use to dismiss the dialog. So this should work:

    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            activity.dismissDialog(DialogID.DIALOG_LOADING);
        }
    });
    

提交回复
热议问题