开发者

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 :

  1. Embed the Video in a ....
  2. On page load, Make an HTTP request through http://gdata.youtube.com/feeds/api/videos
  3. The response should tell you if YouTube is blocked, or the content is restricted in your country/area.
  4. 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜