Gnash and cookies

February 12, 2011

A new release of Gnash, version 0.8.9, is due in the near future. Plenty of bugs have been fixed, but some users are still going to have problems playing YouTube videos. Here's a short explanation.

At some point last year, YouTube started setting HTTP cookies in your web browser, to keep track of which of their video servers is nearest to your machine. This lets them provide a better experience for you (I guess). Here's a diagram of what goes on in your browser:

Diagram showing browser fetching HTML and SWF files, and Gnash core fetching FLV video independently.

As of Gnash 0.8.8, a workaround was added, calling an NPAPI function NPN_GetValueForURL to ask the web browser for the relevant cookies. New diagram:

Diagram showing Gnash core asking browser for cookies, and still fetching FLV video independently.

The downside is that this function was only added in NPAPI version 1.9. This means:

  • Only the NPAPI plugin has this workaround, not any of the other gnash plugins (e.g. the native kparts one for Konqueror).
  • While most browsers do implement NPAPI, not all of them have been updated to include this newer function yet. So the versions of Epiphany and Chromium shipped in Debian at the time of writing do not work with gnash/YouTube as far as I am aware (but Webkit has fixed this upstream).

What does Adobe's plugin do? I imagine it's something like the following:

Diagram showing browser making all HTTP requests, and Gnash core requesting data through the Gnash plugin

So, the good news is, this problem should almost certainly get fixed over the coming Debian release cycle, if only because all the browsers will get updated. In the meantime, disabling cookies (and removing stale ones from YouTube) is a workaround.

Nifty tech tag lists fromĀ Wouter Beeftink