Pages: [1]   Go Down

Author Topic: Embedding Google Video In Webpage  (Read 3459 times)


  • Guest
Embedding Google Video In Webpage
« on: August 05, 2007, 03:12:51 PM »

This html script along with using the free "swfobject.js" javascript to embed swf files into webpages, is a superior one to using the standard "object" and "embed" html tags. Besides its ease of setting up, a major benefit is in getting rid of the pesky gray line and overlay that IE requires you to click on to activate.

I have used this code for many flash movie applications but it took me a while to figure out how to make it work with Google Videos. I'm presuming others have also had a hard time figuring it out and so am providing the info here.

You will need to download the "swfobject.js" file from this website - - unzip it and upload the "swfobject.js" file to your web server. The block of code below  can be copy and pasted into your webpage with just 2 changes that need to be made. Firstly src="swfobject.js" in the first line needs to point to where the swfobject.js file is located on your server. Secondly the variable    fo.addVariable("docId", "4472646496213461848"); needs to be changed to the ID of your Google video. It is a large number similar to the one shown between the quotatin marks and is part of the URL that Google supplies you for viewing or embedding your video.

<script type="text/javascript" src="swfobject.js"></script>

<div id="swfplayer">Flash Plugin is Required</div>

<script type="text/javascript">
    // <![CDATA[
    var fo = new SWFObject(
    fo.addVariable("docId", "4472646496213461848");
    // ]]>

Pasting it as is into a simple webpage will provide this:

The above block of code can easily be adapted to suit other swf file embedding as I have done here on my website:

(this is using a more complex XML based Flashplayer to produce the flash slideshow - not Google vids)
Pages: [1]   Go Up