androidmediacontroller

How to make the MediaController visible throughout my video play


I am using MediaController in my app. But unfortunately the MediaController disappears after a time period of 3 secs. But I want my MediaController to be visible until my video plays fully.

How to achieve this.


Solution

  • By default the MediaController hides itself after 3 secs of time. In order to make it visible throughout our video playback we will have to override the hide() of MediaController. I have given the code snippet below.

    final MediaController mc = new MediaController(this);
    video.setMediaController(new MediaController(this) {
        @Override
        public void hide()
        {
           mc.show();
        }
    
        }); 
    
    video.setMediaController(mc);