Nital
Nital

Reputation: 995

Customize Media Controller

I m using VideoView to display video.

My Requirement is a MediaController wid play/Pause, Stop, & Volume Contoller.. i tried

         MediaController mc = new MediaController(this);  
         View mMediaControllerView = (View)findViewById(R.id.mediaController1); 
         mc.setAnchorView(mMediaControllerView);
         videoView.setMediaController(mc);

adding an imageview to the layout but this seems to have no effect on the MediaController

need some guidance/hint to proceed further...

Thanks.

Upvotes: 2

Views: 12948

Answers (3)

Joris Weimar
Joris Weimar

Reputation: 4941

My "solution" was to not set a MediaController for the VideoView. I just created a separate MediaController class that is its own class and did all the custom drawing. This class was just copied from the source code of the real MediaController. In the constructor of my custom MediaController I pass the VideoView and store a reference so I can interact with the VideoView (VideoView has all the methods you need to interact with the MediaPlayer: getCurrentPosition(), getDuration(), resume(), pause(), seekTo(), ...). Let me know if you need more help with it.

Upvotes: 1

Arun
Arun

Reputation: 2840

You have to write the MediaController Class all over again extending a FrameLayout .The Layout that it uses should be customised. Get the copy from android source code of MediaController Class and then proceed ahead.

Upvotes: 6

ania
ania

Reputation: 2350

This should be enough:

MediaController mc = new MediaController(this);  
mc.setMediaPlayer(videoView);
videoView.setMediaController(mc);

Upvotes: -1

Related Questions