BBC Radio on Linux
“How to stream BBC Radio on Ubuntu Linux –without installing Flash”

TOC

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.

Phantom Gorilla BBC Widget
Phantom Gorilla BBC Widget

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!

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.

No! No! and Thrice No!
No! No! and Thrice No!

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:

Spoofing User-Agent
Spoofing User-Agent

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 Sound of Silence
The Sound of Silence

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:

Open web Developer Tools
Open web Developer Tools

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.

The Elusive Stream URL
The Elusive Stream URL

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

Radio Tray
Radio Tray
  1. Click on the Radio Tray icon in the main menubar and select Preferences > Configure Radios...
    Radio Tray preferences
    Radio Tray preferences
  2. Then add the stream URL you copied from Firefox’s Developer Tools console and save
    Paste in the stream URL
    Paste in the stream URL
    3: You should now have a handy icon in the main menubar for turning that station on or off
    Paste in the stream URL
    Paste in the stream URL

VLC

VLC
VLC
  1. 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
    VLC Open Network Stream
  2. Just paste in the URL and you’re good to go
    Add URL to VLC
    Add URL to VLC

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 Logo. Image credit: fair use
BBC Radio 1 Logo. Image credit: fair use
BBC Radio 1 Xtra
BBC Radio 1 Xtra Logo. Image credit: fair use
BBC Radio 1 Xtra Logo. Image credit: fair use
BBC Radio 2
BBC Radio 2 Logo. Image credit: fair use
BBC Radio 2 Logo. Image credit: fair use
BBC Radio 3
BBC Radio 3 Logo. Image credit: fair use
BBC Radio 3 Logo. Image credit: fair use
BBC Radio 4
BBC Radio 4 Logo. Image credit: fair use
BBC Radio 4 Logo. Image credit: fair use
BBC Radio 4 Extra
BBC Radio 4 Extra Logo. Image credit: fair use
BBC Radio 4 Extra Logo. Image credit: fair use
BBC Radio 5 Live
BBC Radio 5 Live Logo. Image credit: fair use
BBC Radio 5 Live Logo. Image credit: fair use
BBC Radio 5 Live Sports Extra
BBC Radio 5 Live Sports Extra Logo. Image credit: fair use
BBC Radio 5 Live Sports Extra Logo. Image credit: fair use
BBC Radio 6 Music
BBC Radio 6 Logo. Image credit: fair use
BBC Radio 6 Logo. Image credit: fair use

[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!

Share: 
Facepuke
Google+
Pinterest
Scroll to Top