Sample streaming video mediaplayer or how to stream video from url in Android.


I want to share you my sample Android video player. This player can play video from URL. Also below you can download source code of Android Maven project.

My player have individual style. What features does the player have:

  • Nice MediaController. I don’t use MediaController from Android API.
  • New SeekBar style
  • Animation for MedeaController. If user don’t touch screen for the 5 seconds then MediaController slow disapears.
  • Pause playing by click the screen. (Like youtube Android application).

This mediaplayer is not perfect, but it is very good tutorial for newbies. Enjoy!

Here you can see the video:

Download it from github

16 thoughts on “Sample streaming video mediaplayer or how to stream video from url in Android.

  • By dexxtr - Reply

    what type of video files can your player play?

  • By Igor - Reply

    I use MediaPlayer class from Android API. This player play all MediaPlayer supported formats. I don’t discover this. Here you can read the list of suppoted formats

  • By KAZIM - Reply


  • By simbu - Reply

    In this source code video not play the long time. just only 3minutes only play the videos.after received media.getDuration() -illegalstateException error received

  • By jite eghagha - Reply

    awesome it’s not perfect…. but it worked PERFECTLY! thanks for sharing this code.

  • By Igor - Reply

    Maybe you use emulator or device which doesn’t support this code.
    I have this problem when use amulator withour Google Maps lib for application which requires it.
    Try to create another emulator or use another device

  • By Nick - Reply

    Hiya, Thanks for your example code. I was tring to use it to stream .mp4 videos but it fails with errors if I give it a url of an mp4.

    Any ideas ?



  • By vincentfor0214 - Reply

    thank you very much

  • By Abhinaw - Reply

    Good example…..thanks.

  • By lucky - Reply

    hi, i try this code but android (4.0) emulatore show error massage “Unexception error” then app stop

  • By Bryan Adams - Reply

    How i playing media file in local mobile. I have added to sd card, but can’t play it. Please help me

  • By adam - Reply

    I am trying to use this to support streaming media but I am met with:
    06-25 16:23:28.133: W/Surface(7943): Surface.finalize() has work. You should have called release() (32642216, 0)
    06-25 16:23:28.133: W/MediaPlayer-JNI(7943): MediaPlayer finalized without being released

  • By sahrul - Reply

    i can’t download your source code 🙁

  • By asiawatcher - Reply

    anyway we can do this to stream nonstop when the web stream times out and stops ? how can we make this reconnect to stream, everytime thew stream stops ? cheers

Leave a Reply

Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">