Tuesday, March 23, 2010

I've written a streaming MP3 player for Android

It's probably been done and I just couldn't find it, but after I got my Droid I really wanted a way to traverse and play my home MP3 (and OGG) music collection. So I decided I'd write my own app. It would be a good project for me since I'm a long-time VB programmer looking to learn more Java.

At this point, I've got a working beta version that I'm pretty happy with. I was hoping I could use ConnectBot to make a secure authenticated connection to my home server, but my app kept crashing when using it (socket connection issues--need to work on this later). I set up a Lighthttp web server on my DNS-321, where all my music resides, and connected using HTTP (I've got other servers running at home and already use DDNS so this was relatively painless.) The app allows me to traverse all my MP3 files and folders that are on my DNS-321 via a spinner, and I'm able to pick a file/folder for playback. The cool thing is that the MediaPlayer object I'm using, which comes with Android, actually streams MP3 files over HTTP so the playback starts right away. Unfortunately, even though OGG files are supported with this player, they won't stream (boo Google!) So now I'm having to convert most of my music from OGG to MP3, although I plan to implement a pre-download feature for OGG files later. My PS3 doesn't play OGG either so it makes some sense to switch, even though I think OGG is superior to MP3 for several reasons.

If anyone is interested in trying out the beta version of my player (named StreamStar), let me know. I'd like to get some feedback before making it available in the Market. Plenty of bugs remain since programming Android is fairly complex and not nearly as easy as writing a simple desktop app! Not to mention being somewhat new to Java.

PS: I plan to eventually revise the code so that nearly any web server could be used, not just Lighthttp.

2 comments:

  1. I want to try it. I am trying to stream http://1.ice1.sa.streamaudio.com/kzns_am.mp3 on my Epic 4G. Swingwise@yahoo.com

    ReplyDelete
    Replies
    1. Sorry, it won't stream from anything but a web server configured to support directory browsing.

      Delete