How to move MediaController?

I am using mediaController for my application.

By default, Media Controller is displayed at the bottom of the screen.

Is there a way to display the media controller in the middle of the screen?

+16
android mediacontroller
May 23 '11 at 6:47
source share
2 answers

Hosting a mediacontroller only works if the size of the video is known. So you will need to do:

video.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() { @Override public void onVideoSizeChanged(MediaPlayer mp, int width, int height) { /* * add media controller */ mc = new MediaController(YourActivity.this);; video.setMediaController(mc); /* * and set its position on screen */ mc.setAnchorView(video); } }); } }); 
+17
Sep 07
source share

I finally get it.

  mediaController.setAnchorView(findViewById(R.id.main_audio_view)); 

Using this snippet, we can move the mediacontroller to be placed at a specific position based on the layout identifier or view identifier

0
Jun 01 '11 at 7:23
source share



All Articles