Android VideoView MediaPlayer OnInfoListener - events not fired

后端 未结 7 1311
借酒劲吻你
借酒劲吻你 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

    Not fully sure as to what the OP is asking, but here are some very untimely bits of information.

    I wouldn't rely on onPrepared. I find it to be unreliable.

    I have found the two most useful pieces of information for HLS streaming through the MediaPlayer are the duration of the video and the progress position of the video. You get both of these by listening to progress updates.

    When the duration is greater than zero, you know the video is truly prepared and can be manipulate (scrub). When progress position changes, you know the video is done buffering and has commenced playback. This last item only works when the video is playing of course. The MediaPlayer tends to relay inaccurate information.

    These pieces of information are mostly accurate and can usually be relied upon to be "fairly" timely. This timeliness varies from device to device.

提交回复
热议问题