28 May, 2013

YouTube and Firefox

It seems fairly common for Firefox users to suddenly find that some embedded YouTube videos will not play even though they may have done so previously. The problem often being highlighted by the error message "An error occurred. Please try again later". There can be many causes and many fixes but since this problem has occurred for me several times and the fix has been the same each time then I thought it might be useful publish how I dealt with it.

A simple explanation. "Embedded" refers to objects that can exist in their own right but have been used to form part of a web page. A YouTube video is an example of this and for it to play within Firefox uses an added feature (a "plug-in") called "Shockwave Flash". Now just hold onto that concept for moment and we'll move on to the subject of cookies. Cookies are small text files stored on your computer to help websites function as intended by the website designer. Cookies are intended to be beneficial but they have been abused by some and sometimes have problems of their own and it is the latter we are concerned with here as Shockwave Flash stores cookies on your computer to enable it to function as intended. 

Let's review where we are up to then; a YouTube video can be "embeded" in a web page and needs Shockwave Flash to play it.  For Shockwave Flash to function properly small text files called cookies are stored on your computer. There's actually more to it than this but it will do for our purposes here.

The last thing you need to know about is updates and hopefully this is where it all becomes clearer because what happens is that when Firefox and/or Shockwave Flash are updated the information that is in previously stored cookies can be incompatible with the update and so an error occurs, hence the message "An error occurred. Please try again later".  It would be good if  the old cookie was automatically replaced but it isn't, so what's needed is a new compatible cookie and the way this is achieved is simple.

The solution. Deleting the existing cookie will result in a new and therefore compatible cookie being stored next time YouTube is used. There's a quick and dirty way of doing this and a slightly more targeted and cleaner way.