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.setMediaC开发者_如何学运维ontroller(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.
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.
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.
This should be enough:
MediaController mc = new MediaController(this);
mc.setMediaPlayer(videoView);
videoView.setMediaController(mc);
精彩评论