YvoSchaap.com

A Problem Must Be Solved, Resolved, or Dissolved

Thursday, September 20, 2007

Plug-and-Play YouTube videos

YouTube released a new data API a few weeks ago based on Google’s gData. Reading through the docs to implement it into my YouTube search, I found the option for JSON (in script). With the JSON function you can grab youtube’s videos without having to use a local proxy for AJAX request. The local proxy is needed due to javascript security settings blocking request to other domains, but usually slows the process alot. Also using server side scripting where the data is grabbed, HTMLized and included is usually to difficult for implementing if you just want to add a few vids somewhere.

I wrote a plug-and-play script to include YouTube video’s in your site instantly without having to use local proxies, flash, or any other work around. All you need is to include the javascript and where ever you want to add a few videos - to for example a blog post - you add this code:

<div id="youtubeDiv">
<script>
insertVideos(’youtubeDiv’,’search’,’madonna’,’15’,1);
</script>
</div>

How it works

  • you start a function with serveral settings like the search query, or a username
  • the function loads the JSON from YouTube and executes a script that shows all thumbs in the layer specified
  • you can have the video play as an overlay or redirect to the youtube site

  • Instructions and examples are on this page. It’s a very early release so options like sorting are not functioning yet.

    Posted by Yvo on 09/20/2007 | Permalink
    Page 1 of 1 pages

    [ home ]