Android VideoView MediaPlayer OnInfoListener - events not fired

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

    If you want to show loading each time it's buffering (initial time or subsequent buffer underruns) just ensure to show it again:

    // at the beginning
    show
    
    boolean onInfo(int what, int extra) {
      switch (what) {
        case MEDIA_INFO_BUFFERING_END:
          "hide";
          break;
        case MEDIA_INFO_BUFFERING_START
          "show":
      }
    }
    

    So this event sequence will do as desired:

    - whenever you start (setVideoURI or start): show
    - onPrepared: just plug the info listener
    - onInfo BUFFERING_END   hide (it's playing)
    - onInfo BUFFERING_START show (it's buffering again)
    - onInfo BUFFERING_END   hide (it's playing)
    

    Update:

    This is assuming the info events work. Of course.

    0 讨论(0)
提交回复
热议问题