ZeeShaN AbbAs ZeeShaN AbbAs - 1 year ago 107
Android Question

Android mediacontroller Play Pause controls not refresh properly

I have used MediaController in my activity its working fine but when I play video for first time then there should b pause button visible but instead there is play and when I press that button then the video is paused correctly and state remains the same and after that its working properly. And same thing happens when Video Completed.
Is this a bug or I am doing any thing wrong?

videoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
mediaController = new MediaController(VideoPlayerActivity.this){
public void hide(){
public void show(){

aj8 aj8
Answer Source

I've been having the same issue. I was not calling MediaController.setVideoView as you were, as I thought VideoView.setMediaController was sufficient for wiring things up. I tried adding that, then moving the call to show within onPrepared, and now it is working.

I wish I had a better understanding; my best guess is that perhaps everything needs to be wired up properly before the media is prepared, and before calling show. In any case, here is what I have:

mMediaController = new MediaController(VideoPlayerActivity.this, false);

mVideoView.setOnPreparedListener( new MediaPlayer.OnPreparedListener() {            
    public void onPrepared(MediaPlayer pMp) {

mVideoView.setVideoPath(uri);  // may not be applicable in your case
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download