• Could not connect to Twitter

Taming Flowplayer Pt. 1

Getting Flowplayer up and running on the site was not quite as smooth as the nice web-site and clean API suggested. I’ll be documenting the whole gory process in the ‘Building a Website (with Python, jquery etc..)’ series, but in the meantime I’ll mention the hideous hackery needed to get over the final hurdle that is Internet Explorer 7.

Somewhere along the line I was looking to pass a web-address, as part of an html overlay, into the flash-player. This has the standard form:

"http://showmedo.com/videotutorials/video?name=1470110&fromSeriesID=147"

Now if one tries to pass that string into a flashplayer, all hell will break loose. Some of those symbols are going to be interpreted as controls rather than nice, neutral characters. For this reason they need to be ‘escaped’, and Turbogears provides a nice little function “quote_plus”, via Python’s urllib, to do just this. The result is this rather scary looking string:

"http%3A%2F%2Fshowmedo.com%2Fvideotutorials%2Fvideo%3Fname%3D1470110%26fromSeriesID%3D147″

This string makes it through the flash-player in all the browsers we’re interested in at Showmedo and produces a clickable flash-overlay which, strangely enough, takes one through to the page in question. Er, except (and twas ever thus), IE7 (not 8 <sigh>), where, when all the escape-artistry has taken place, we find ourselves directed to this non-existent page:

"http://showmedo.com/http://showmedo.com/videotutorials/video?name=1470110&fromSeriesID=147"

which is a very poorly URL indeed.

Now I’m guessing that somewhere at the heart of this is the issue of absolute and relative web-addresses.  The second ‘http://…’ should be interpreted as an absolute address, but those unicode escape-characters have confused the system, making it treat the URL as relative, thus adding another root-url.

If I had time to explore this horror I would probably spend it doing something else, but in these time-starved times I just did a little bit of playing around and added a hack-function which undoes the ‘:’ and ‘/’ escapes of “quote_plus”, producing this:

"http://showmedo.com/videotutorials/video%3Fname%3D1470110%26fromSeriesID%3D147″

Which makes it through the browser minefield, but, as seems so often the case with this messed up web-development world, at the cost of some serious inelegance.

Please share:
  • DZone
  • del.icio.us
  • Reddit
  • Furl
  • Ma.gnolia
  • email
  • StumbleUpon
  • Technorati
  • TwitThis
  • Slashdot
If you enjoyed this post, make sure you subscribe to my RSS feed!

Related posts:

  1. Using Python strings and dictionaries to create video embedding templates
  2. New flash-player being debuted
  3. Testing Flowplayer embedding script

Comments are closed.