If YouTube clips are barred for user - script to offer alternative?
We have a website that offers educational courses, and we use some YouTube clips. However, many students connecting via their school or university computer are barred from accessing YouTube, thus our page has black squares where our videos should be.
Is there a way to offer a local video alternative if the YouTube clip won't load (is blocked)?
Script? The site is using classic asp, though I suspect a solution would be c开发者_StackOverflowlient-side javascript. I have no idea where to start.
Thanks Geoff
Logical steps :
- Embed the Video in a ....
- On page load, Make an HTTP request through http://gdata.youtube.com/feeds/api/videos
- The response should tell you if YouTube is blocked, or the content is restricted in your country/area.
- Look at that response, and show/hide the div based on the respons, and show/hide another div embedding another video ( from local sources ).
Javascript is ideal for this.
<script src="jquery...."/>
<script>
$(
function(){
// Make HTTP query here $.get(url, response_function);
// Use response_function to show/hide the div whose id you know.
// also use response_function to show/hide the div which contains the local video sources' videos
}
);
</script>
精彩评论