Search code examples
androidmedia-player

Create custom media player like Youtube in Android


I have to create media player like youtube player.Actually if i use VideoView for play video and MediaController for controll video(MediaController onlyu provides play,pause,next,pre and seek options).But in my player i have to add one more option i.e bandwidth(I would have three bandwidth and on clicking on bandwidth video will play).So please suggest me.


Solution

  • As far I know, MediaController doesn't give many opportunities to be customized. So, you have two options depending on your UI requirements and the effort you are willing to do.

    1. The hard way: You can just get rid of Android MediaController and implement your own media controller, since you are not bound to use it. MediaPlayer (through VideoView) provides you the needed functions to build it: pause(), play(), resume() methods and event listeners like onPrepared, onStopped, etc. To display the progress bar you can use SeekBar, but you will have to code the interaction with MediaPlayer (this is, the progress bar will not move alone).

    2. The easy way: you can find another place to put your bandwith button, for instance, on the top of the screen. You might even place your button over MediaController.