How to create a user interface for android MediaController

I want to configure the controls in MediaController for my video player. I want to change the image to the play button, change the skin, change the color, etc.

Is there a known way to do this?

thank

+52
android android-video-player mediacontroller
Sep 18 '12 at 17:40
source share
2 answers

I had the same problem in a recent project, and ended up creating my own implementation based on the standard MediaController. It adds a full-screen button in the far right corner, but even if this is not what you need, this class should be a good starting point.


The code:

Image Resources:

  • enter image description here
  • http://imgur.com/JYJGN
  • http://imgur.com/R0txq
  • http://imgur.com/dQ6wA

Gotchas:

  • The class assumes that the anchor view is a FrameLayout for positioning below.
  • The class does not use Window to provide floating point control over the anchor. However, this is not a problem for me, since the show () method executes mAnchor.addView () each time.
  • The class uses the native protocol MediaPlayerControl. This allows settings like toggleFullScreen ()

UPDATE (2013) : For details, see this guide: http://www.brightec.co.uk/blog/custom-android-media-controller

UPDATE (2018) : Now you can use the wonderful ExoPlayer and fully customize your player’s user interface by simply overriding the layout file.

+100
Jan 14 '13 at 17:07
source share

I tested it and it works fine on 4.4 kitkat, but, like KAPLANDROID, the black screen appeared on Android 2.3.6, but the music and video controller work fine,

Find a solution, just put this code

 videoHolder.setType( SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS ); 

after that

 videoHolder.addCallback( this ); 

and are you ready to go

-5
Feb 14 '14 at 19:07
source share



All Articles