tags:

views:

59

answers:

1

Hi, I'm looking at embedding youtube videos onto a webpage (a Drupal webpage if that helps), but I need to figure out what people will see if their business/workplace/country blocks youtube access.

Does it show 'video no longer available', does it not show anything?, does it add a class or ID to the embedded html to let css, or a scripting language know that there is an error.

I would like to be able to swap the embedded code out for a gif or something else. So users that can't access youtube will not be left with what ever youtube decides to show them.

Any tips would be great.

I tried editing the hosts file to test myself but it wouldn't take for some reason.

Cheers.

EDIT: * first-question *

+2  A: 

This can be achieved using javascript.

In your script call a resource that is located on youtube. Since it's javascript running in the client browser, the request will comes from it and not your website.

If the request fail, the client has no access to youtube.

Did I mention that relying on external resources you can't control is bad ?

Pierre 303
+1 for thinking outofbox
Sachin
I think he meant a successful youtube connection but showing "video no longer available" that is different than a failed http request. Probably you won't discover that until you press the Play button. I'm very interested also on this. +1 for the question.
corbacho
I was trying to find how youtube changed it's output if they are blocked. From what I could find, they don't. So if you are block from youtube you will see a blank page and no error. I've tried what Pierre said, using the code from here: http://stackoverflow.com/questions/286021/detecting-if-youtube-is-blocked-by-company-isp/286055#286055 and it works. It's not really the solution I'm looking for, but I think, as I'm relying on youtube's output, I will have to use this method. Cheers :)
Doyle