Search code examples
androidvideoprogress-barandroid-mediaplayer

Android video player custom control panel


In my app, I have a video player. There is a custom control panel for that. I have implemented play, pause, stop functionality using the MediaController class. Now I want to add a progress bar in that control panel. How can I implement that? Can anyone give me any sample code or idea for the same?


Solution

  • Use a SeekBar. Then find the total length of your media, and set that as the max value. Update this SeekBar on a regular interval as the media plays along - for example every 5th second - depending on the media length. (Interval would have to be shorter if the media file is short).