2

I have a video view which uses media controller. I want to hide the media controller somehow without doing video_view.setMediaController(null); If I do that then the following code won't work:

this.setVolumeControlStream(AudioManager.STREAM_MUSIC); 

So I want to hide the media controller permanently while the video is playing but still be able to turn the volume up and down. How can I do that

bytebiscuit
  • 3,446
  • 10
  • 33
  • 53
  • video_view.setMediaController(null); remove this line and try..! – Noby Nov 15 '11 at 14:02
  • That line is supposed to remove the media controller but it will also disable volume control. So I want to keep the media controller somehow but hide it permanently while the video is playing. – bytebiscuit Nov 15 '11 at 14:06

2 Answers2

12

This might help if to remove permanently controller...

    VideoView videoHolder = new VideoView(contex);
    MediaController controller=new MediaController(this);
    videoHolder.setMediaController(controller);

then apply this statement to hide permanently your controller...

    controller.setVisibility(View.GONE);

just call this to show it again...

    controller.setVisibility(View.VISIBLE);
wattostudios
  • 8,666
  • 13
  • 43
  • 57
Rindang Septyan
  • 131
  • 1
  • 5
5

Try this.

MediaController mediaController = new MediaController(this);

apply on touch listener on your video view. in that place this code.

if(mediaController.isShowing ()){
   mediaController.hide();
}

here is the link for more info.

Noby
  • 6,562
  • 9
  • 40
  • 63
  • It stars by first showing the media controller, during this time I can change the volume. When i touch the screen it hides the media controller but it also doesn't allow me to change the volume anymore. It's like the volume control and media controller are wrapped inside the same Anchor View – bytebiscuit Nov 15 '11 at 14:41
  • I think media controller contains volume controller in it. So we may can't separate these both. – Noby Nov 15 '11 at 14:46