Been super busy finishing up contract work and now MovemberBN. With KristalFM being the official broadcast station for MovemberBN and their recent relaunch with an online streaming option, I thought it would be fitting to have an Android streaming app for KristalFM.
Direct APK Download
This app is still very beta and there are quite a few improvements I am looking at implementing on a standalone KristalFM app
- Notification & Background service
- Track/Buffering information
If there is anything else you would like to add for a standalone app, do let me know in the comments.
So after the ‘failure’ in Part 1 the next step was to roll my own solution. I’ve been listening to the TWiT.tv network since Leo Laporte started it many years back and I noticed that they were running an Icecast server at TWiT.am that streams their audio. Perfect, a great place to start off so do a simple search for icecast on my Ubuntu box which gave the following results.
Went ahead and installed icecast2 and ices2 and after Google searching and fussing about I managed to get Icecast running and went on to configuring ices2. It took me some time to understand that Icecast streaming involves 2 components: the Icecast server (which is the machine people connect to in order to listen) and a source client which connects to the server and provides the audio source to the server to be streamed out. Started off with the typical playlist configuration as I did not have a radio at hand. Managed to get OGG streaming to work but then tried it on my sister’s iPad and was reminded that Apple doesn’t really like OGG and would probably only work with an MP3 or AAC stream. So I started fussing around with MP3 files and only to find out that ices2 didn’t support MP3 streaming (I tend to skip over things in my brain’s weird attempt to speed read and thus glossed over this fact: it’s even stated in the screenshot above that it is for “Ogg Vorbis streaming”). Oh well. Then for a reason I thought that I’d try a solution on Windows (I think I blame my possible ADDnes).
It was during this adventure in WIndows Icecast server setup that I discovered ezStream via the Icecast forum’s “Common Source Client List” and was able to configure MP3 re-enconding. The problem I ran here was that I could not hook the line-in input from my phone acting as a radio. I switched back to Linux and managed to get ezStream working but did not find a way to get it to stream from the line-in audio port as perhaps my Linux / gstreamer fu is not good enough yet. In a stroke of luck (or proper research and reading) I finally found darkice which solved my Linux streaming (for those who don’t like the command line there is darksnow that provides a good GUI interface for the darkice source client).
On yet another whim, I decided to tried setting up an Icecast server in OSX (I think it’s one of those ‘because-I-can’ syndromes, that I tried doing this). I managed to get Icecast running easily thanks to
MacPorts using a simple “sudo port install icecast2” but getting a source client was a bit more troublesome. I started with trying darkice due to my success using it in Linux. The problem? It required JACK audio connection kit which I could not get working in OS X. I have to say that JACK documentation seems severely lacking and I’m still left wondering how to use it. There is an OS X implementation of JACK called Jack OS X. I tried to understand how it works and how to use it using this YouTube video embedded below (turn on close captions, CC, for English subtitles) but new interfaces did not show up when starting applications so still no dice.
There was also a darkice Mac OS X branch build that I got the source (svn checkout http://darkice.googlecode.com/svn/darkice/branches/darkice-macosx darkice-macosx) for, but it seems that I do not have the necessary tools to compile it . So finally I found LadioCast which was the same saviour for OS X as darkice was for Linux. So I managed to get a Linux and OS X implementation running and there goes @mfirdaus managing to get it all working on his N900 with some gstreamer magic of “gst-launch pulsesrc ! audioconvert ! lame quality=9 ! shout2send mount=/listen.mp3 port=8000 password=password ip=127.0.0.1”.
Now while the reception on the N900 wasn’t fantastic, it is a great self-contained solution: no external radio or external monitor / keyboard to for configuration. So right now we have 3 implementations but still no proper Windows stand alone solution. I know there is Winamp with a shoutcast plugin, but I’m not sure how to pipe audio from a line-in port into Winamp.
So as I tinker and try to get a proper Windows configuration, I have set up an Icecast server at whose playlist can be accessed at http://bit.ly/pilihan. This URL should work for all platforms (tested with iOS, Android and VLC). You can just click the link and open the m3u file in the default player. This is my own server so may not be up all the time if there is some weird configuration issue / power outage, but hope it helps those who want to listen when they don’t have a radio at hand or for those overseas. Trying to get MFN to get a hold of the IT people at RTB to see if they can implement this on their own servers, but in the meantime self-hosting
TLDR: Click http://bit.ly/pilihan and listen to my server streaming Pilihan FM
Hearing the calls of people wondering how to listen online to Pilihan FM 95.9, a national news radio station. Previously there was an online streaming feature but it seems to have broke. I managed to track down the website page that I presumed used to stream online but it just gave a Flash player that did nothing after pressing the “Play Radio” button. So being curious as I am, I took a look at the source of the page to see if there was any hints of the URL that they used for streaming. Sadly there was nothing, just the .swf Flash file, meaning that the Flash file itself has the necessary information to start the stream. What I needed was a Flash decompiler.
A quick Google search and I found flash-decompiler on Google code, which so conveniently is an Adobe Air application and thus is cross platform. Typically tools such as these are built for Linux or Windows, but I’m running OS X so at least I didn’t have to use another computer or boot up a Virtual Machine to use the tool. The decompiler was easy enough to use: just supply the location of the Flash file and click “Parse” and it greeted me with 3 tabs: “Header Section”, “Tags” and “AS3 Classes”. The “Tags” tab seemed to have quite a bit of information so slowly I took a look at it, trying to find what the play button did and if there was any URL that it processed. After a bit of search viola! mms://184.108.40.206/pilihan was found!
I tried to load the stream, but there was no response. So it seemed that this was a dead stream that no longer exists or that the streaming device / configuration just died. So this round 1 of exploration is deemed as a failure results-wise as the goal of being able to stream the radio online was not met.
So what do you do, when services provided by others don’t work? Well you roll your own solution! In the continuation post we shall learn how to stream audio from a device to the World thanks to the wonders of the Internet. Stay tuned!