I have a videoview and when the video starts, the media controller is shown for 3 seconds. I want to hide the media controller unless i tap on the screen. I tried
MediaController mc= new MediaController();
mc.hide();
Videoview.setMediaController(mc);
..
..
..
But it didn't work.. Any suggestions please?
This isn't really a solution to hiding the MediaController, but if you want to get rid of the thing altogether, do this:
You can have it initially hidden by doing the above, and then when you want it to show (onClick or onTouch or whatever), just make a new MediaController and set it on the videoView. I added a boolean to prevent the action from happening more than once.
Specifying
videoView.setMediaController(null)
is not necessary.The problem is you cannot hide the controller till it fully prepared.
Use OnPreparedListener and in the callback onPrepared do your hide inderectly, like:
Unfortunately, this is hardcoded behavior in
VideoView
:As a workaround, wrap the
MediaController
in your own class and suppress the initialshow()
call, like this:Then, simply hookup the
MyMediaController
above as usual, e.g.:Now, the controls are initially hidden, and they show up as expected when the user taps the screen.