Gnash and BBC glow

July 19, 2010

One thing I noticed having started to use gnash is that the BBC's iPlayer website (UK-only, I believe) gives a message like "You do not have Flash player installed" - not merely complaining about the version, but actually not recognising gnash as a Flash player at all.

Cue some digging. The BBC's pages use glow, an in-house JavaScript library (available under the Apache 2.0 License) to detect whether Flash is installed. The documentation was really easy to follow - I had a test page going quicker than you can say "Hello, World!"

The bottom line is, glow uses this regex:

var regexFLASH_VERSION = /^Shockwave Flash\s*(\d+)\.(\d+)\s*\w(\d+)$/;

and gnash uses a description like this:

Shockwave Flash 10.1 r999.
Gnash trunk, the GNU SWF Player. Copyright (C) 2006, 2007, 2008, 2009,
2010 Free Software Foundation, Inc.
Gnash comes with NO WARRANTY, to the extent permitted by law. You may
redistribute copies of Gnash under the terms of the GNU General Public
License. For more information about Gnash, see
http://www.gnu.org/software/gnash.
Compatible Shockwave Flash 10.1 r999.

Note the dollar sign at the end of the regex. Indeed, rebuilding gnash without all the notices at the end of the description lets you see the iPlayer UI. (It doesn't actually play anything, don't get your hopes up.)

Interestingly, different parts of iPlayer require different minimum versions of Flash. Clips of radio programmes tend to be more liberal with what they will accept - right down to version 7. Most TV streams and clips require at least version "9.0 r115", and I've heard they use SWF verification. I'm not sure how legal it is to implement that, although apparently code exists.

Nifty tech tag lists fromĀ Wouter Beeftink