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.

Quick and dirty. Just go to the history menu and select "Clear Recent History" and ensure that Cookies box is ticked before clicking the "Clear Now" button. That's sort of it but not quite. Any websites that you selected to member your login details will now require you to log in, a minor deviation from normal except if you have forgotten those very details. So before you use this option be absolutely certain you know all your usernames and passwords.

Targeted and Cleaner. This is the better choice, slightly more involved in the first instance but once done, it's done - passwords etc. for other websites will not be affected.

From the "Tools" menu select "Options" and in then in the options panels click the text "or remove individual cookies".

A list of cookies will be displayed, there will be lots of them so look for the folder "youtube.com" and click on the "+" next to it to reveal the cookies contained in that folder.

Click on a cookie listed in the "Youtube.com" folder and then delete it by clicking on the "Remove Cookie" button. Repeat this for the rest of the cookies in the "youtube.com" folder.

If you see a folder "accounts.youtube.com" you do not need to do anything with it.

Click on close when finished and that's it. Next time you view a YouTube video those cookies will be replaced and all will be well.

As I said on opening there can be many causes and many fixes but this is simple and straightforward to do so it's a good place to start and likely to be all you need to do. Finally, this problem isn't limited to Firefox and a similar problem in other browsers may well be able to be fixed in a similar way.