In one of my idle weekend tinkering sessions, this morning, I contemplated installing Linux [Ubuntu to be precise] on an old iMac I have lying around. Reasons being; said iMac runs OSX El Capitán like a slug on Mogadon and also, I only really use it for listening to the radio, while I’m on my gym. So ideal experimentation fodder.
Difficulties with Streaming BBC Radio on Linux
Doing a rare bit of pre-emptive reseach, I was surprised to find that this one simple task looked like being a bit of a palaver on Linux.
On OSX, I use the splendid Phantom Gorilla BBC Radio Widget, which allows me to start streaming my morning fix of unfunny old comedies with the click of a button —and then get on with vainly trying to bench press an old broom handle with a helium-filled balloon on each end.
There doesn’t seem to be an equivalent on Linux. There are one or two Dashboard-esque offerings, but the choice of widgets seems to be pretty much limited to system monitors, clocks, weather widgets and the like. The most hopeful looking candidate I found was a radio streaming app called Radio Tray, which can be controlled via an icon in the main menubar.
Unfortunately, Radio Tray’s list of built-in radio stations doesn’t include any BBC ones. So they have to be added manually. Yet again, this turns out to be not as simple as it ought to be —the BBC aren’t exactly Linux friendly!
- For one thing, BBC iPlayer is an Adobe Air programme, so it doesn’t run on Linux.
- For another thing, The Beeb don’t publicise the URLs of their streams. If they did, that might allow you to access them on Linux from an iPlayer alternative. But apparently they won’t disclose them, even if you contact them and ask nicely. They obviously really want you to use only the official iPlayer to listen.
Instead, The Beeb recommend Linux users just make do with the 'Listen Live' facility on their website. However, the 'Listen Live' facility will throw an idiotic "You need to install Flash" error in your face, if you try to do so using a desktop Linux browser.
As I pointed out a while back, this is complete bollox. The BBC is quite happy to serve you up radio and video streams on iOS and Android browsers —neither of which support Flash. So, it’s beyond me, why they persist in this spurious demand, that anyone visiting via desktop browser, first install that security-hole-ridden piece of crap, Flash.
Using Browser Spoofing to grab the BBC Radio Streaming URLs
Fortunately however, the same browser spoofing technique I used in the previously mentioned post [which was about accessing iPlayer without Flash on OSX] can be employed to do the same in Linux:
First of all, you’ll need to install a User-Agent spoofing add-on for Firefox [or equivalent for any other browser you use]. I chose User-Agent Overrider for no other reason than it was top of the list when I searched for such a beastie in Firefox’s Add-Ons window.
Once the add-on is installed, you can select a new User-Agent for your browser to masquerade as:
In theory, either iOS or Android should be an equally good choice. However if you choose Android and then click the 'Listen Now' link on the BBC streaming page, the resulting URL will be URL Encoded and pre-fixed in an intent:
tag, which your browser won’t understand [since it’s not really running on Android]. I presume the intent:
tag is to do with how Android pops up a dialogue, asking you which app you want to use to open non-standard links. Whatever the whys and wherefores, I found pretending to be an iOS browser was the most straightforward approach.
Once you’ve disguised your browser as iOS safari, reload the BBC page for the station you’re trying to stream [eg: Radio 4] and click the 'Listen Live' button.
Although you won’t hear anything, you should at least no longer see the annoying "Install Flash" pop-up and the play button should change from showing a speaker to a Pause Button, indicating that —even though your desktop browser can’t handle what the BBC is sending it—at least you’re receiving something!
The only thing we have to do now is find out what the beeb is sending us [ie. the URL of the stream] and then we can give Radio Tray that URL to play. To do this, open Firefox’s Developer Tools Console:
In the window which opens, click on the Console
tab, which logs the various types of errors which were generated while the page was loading [make sure the JS
button is on]. You should be able to see the error generated by the browser when it didn’t understand the stream the BBC was sending it. And right there in the error message will be the elusive URL of the stream itself.
Playing the BBC Radio Streams with Radio Tray / VLC
Armed with that URL, you can then add it to your Linux radio player of choice. For example:
Radio Tray
UPDATE: Some more in-depth testing has revealed that Radio Tray has a tendency to drop the stream, after about a minute of playing. As I had so many streams to test, when composing this article, I’d only tested each one worked by playing it for about 30 seconds —D’oh!
VLC however works fine. I played one of these streams for over an hour, using VLC this morning, without issue. So, I recommend you use VLC until I get to the bottom of the Radio Tray problem
- Click on the Radio Tray icon in the main menubar and select
Preferences > Configure Radios...
.Radio Tray preferences image::/grafix/beebonlinux07.jpg[] - Then add the stream URL you copied from Firefox’s Developer Tools console and save .Paste in the stream URL image::/grafix/beebonlinux08.jpg[] 3: You should now have a handy icon in the main menubar for turning that station on or off .Paste in the stream URL image::/grafix/beebonlinux09.jpg[]
VLC
- If you’re a VLC fan [and who isn’t?!], you can use its
Media > Open Network Stream
menu item to play the stream in VLC. .VLC Open Network Stream image::/grafix/beebonlinux11.jpg[] - Just paste in the URL and you’re good to go .Add URL to VLC image::/grafix/beebonlinux12.png[]
I think the Radio Tray approach is the neatest, but if you’re already a heavy VLC user, you may prefer to use that instead.
List of BBC Radio stream URLs
Anyway, using this technique, you can grab the URL for any BBC Radio station stream. But for all you TL;DR; impatient types, here is a list of URLs for the main national stations:
BBC Radio 1
BBC Radio 1 Xtra
BBC Radio 2
BBC Radio 3
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/ak/bbc_radio_three.m3u8
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/llnw/bbc_radio_three.m3u8#t=0 or
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/llnw/bbc_radio_three.m3u8
BBC Radio 4
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/ak/bbc_radio_fourfm.m3u8
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/llnw/bbc_radio_fourfm.m3u8#t=0 or
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/llnw/bbc_radio_fourfm.m3u8
BBC Radio 4 Extra
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/llnw/bbc_radio_four_extra.m3u8
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/ak/bbc_radio_four_extra.m3u8#t=0 or
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/ak/bbc_radio_four_extra.m3u8
BBC Radio 5 Live
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/ak/bbc_radio_five_live.m3u8
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/llnw/bbc_radio_five_live.m3u8#t=0 or
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/llnw/bbc_radio_five_live.m3u8
BBC Radio 5 Live Sports Extra
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/llnw/bbc_radio_five_live_sports_extra.m3u8
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/ak/bbc_radio_five_live_sports_extra.m3u8#t=0 or
- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/high/ak/bbc_radio_five_live_sports_extra.m3u8
BBC Radio 6 Music
[Let me know if any don’t work. I stopped checking them individually part way through, because it was tediously repetetive]
Disclaimers / Caveats
Couple of final thoughts/caveats:
You’ll notice, in Firefox’s Developer Tools Console, the stream URL appears in two guises; one that ends in #t=0
and a slightly different one which doesn’t. Both seem to work equally and the second works with or without #t=0
on the end. I’m not certain what the difference is. I suspect though that t
stands for "time" and that the #t=0
version of the URL is setting some kind of timer to zero. It didn’t seem to make any difference in playback though. ie. it didn’t [as I half expected] start that stream playing from the beginning of the programme. So I’m not sure what it’s for. Perhaps it’s for use with the Rewind 30 mins
feature which the full-fat iPlayer has?
Also, since I’m living in the UK, I can’t test whether or not these streams will work outside Blighty. I suspect that they won’t as I’m sure the Beeb will be using some kind of GeoIP detection to stop 'Johnny Foreigner' from getting a freebie listen.
YM, as they say, MV!