I am wondering whether any of you have ever come accross a solution/function that allows embedding YouTube videos with a fallback solution where an alternative video source is selected if YouTube videos - and the videos only! - are blocked.
One of our corporate clients have access to the web via a proxy server that weeds out flash content served form YouTube. More specifically anything served from ytimg.com is blocked. Since their website is quite heavy on product videos they find it annoying to boot that clients can watch videos on their site while their own staff can't.
Any suggestions?
You should try to make an Ajax request to something hosted in youTube, i would say something like this:
function check_youtube() {
$.ajax({
type: 'GET',
dataType: 'json',
url: URL_ON_YOUTUBE,
timeout: 5000,
success: function(data, textStatus ){
alert('Woot, Cat videos on the way!');
},
error: function(xhr, textStatus, errorThrown){
alert('Ooops, You suck, proxy blocking your way');
}
});
}
It should be clarified that Youtube's Flash player is a different thing than the FLV or MP4 file that it plays. While the Flash player may be served from *.ytimg.com, the streams themselves come from hosts like "o-o.preferred.lga15s18.v2.lscache6.c.youtube.com".
If your client is blocking the former, then you can't use Youtube to get at the videos. My approach would be to launch your videos from a page that has some sort of automation to recognize your client's IP address range and load up your own copy of jwplayer or flowplayer or somesuch.
While you could do this browser-side using something like an ajax call, you still run the risk of overly-conservative corporate IT disabling javascript. (I've seen it happen. It's not pretty.) Putting the "smarts" on your server leaves you in control, though of course it means you need to know ahead of time what the restrictions are, so that you can adjust for them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With