Thursday, January 1, 2009

MeRadio - A Shoutcast Radio Streaming Client for Java ME


a new year and a new project. This time it's a Shoutcast radio streaming client for Java ME, which I started as a hobby project. I called it MeRadio. Inspired by this post to stream Shoutcast streams to the IPhone, I wanted to make such an application (MIDlet) for Java ME (J2ME). Here it is in an initial version:

The download package (links below) contains:
- a server part which consists of three files: meradio.php5, mr.xml and php.ini
- the mobile application MeRadio (Nokia and Sony Ericsson version) with its source

The Server

The file meradio.php5 has two main functions: First it delivers the radio stream URLs from mr.xml to the mobile application, second it streams the plain audio data (mp3) of a radio station to the mobile application, while stripping off useless Shoutcast headers, which cannot be understood by Java ME.

When you want to install this server on your webspace, php must be supported. Maybe the php.ini is also needed, which sets the property "allow_url_fopen = on". This is needed for customers of 1und1. And maybe the file extension php5 doesn't work for you. Then you should rename meradio.php5 to meradio.php. The file mr.xml is an XML formatted document containing some predefined radio stations mostly taken from the radio list of Ninj's Virtual Radio Symbian application ( Put all 3 files into the same directory of your webspace.

Test the service using a webbrowser:
- Get the radio list using this URL: http://yourhostname/meradio.php5?rlist=1
- Hear the stream of a radio e.g.using this URL: http://yourhostname/meradio.php5?play=

The php will stop executing after 24 minutes to limit the traffic on the server and on the phone. You can adjust this value according to your needs.

The Mobile Application

Select the Nokia or Sony Ericsson version of MeRadio and simply install MeRadio.jar to your Java enabled phone. During the first start you will be advised to set the URL to meradio.php5 properly. Some Nokia devices need a port number after the hostname, otherwise an invalid locator exception might be thrown. This URL can be entered in the settings menu. Then you can click on Genres, which loads the genres (and radios) from the mr.xml file using meradio.php5. This may take some seconds, especially on Sony Ericsson phones. Then you can choose a genre and select a radio stream of interest. Now you should be able to hear the selected stream with very few or even no annoying gaps that often occur on other streaming solutions based on Java ME.

Here is the download link for the current version 0.2a:



Version 0.2 introduces these updates:
- Radio list is persistently saved in the RMS (radio list doesn't need to be fetched from the server everytime the MIDlet starts)
- Radio list can be updated when necessary
- Different versions of MeRadio for Nokia and Sony Ericsson phones, as these devices support different streaming mechanisms
- Small updates to meradio.php5 and new radios (Techno) in mr.xml

I have successfully tested MeRadio on a Sony Ericsson W850i and on a Nokia 3120 classic phone (S40). You can change the source as you wish and play with it. Bug reports are always welcome as this is a new project.

Have fun with it and a happy new year

Here are the download links for the old versions:

Version 0.2:

- FileFactory:

- MegaUpload:

Version 0.1:

- FileFactory:

- MegaUpload: