Ad
Ad
Ad
Pages: [1]   Bottom of Page
Print
Author Topic: Embedding Google Video In Webpage  (Read 3074 times)
robertwatcher
Guest
« on: August 05, 2007, 02:12:51 PM »
ReplyReply

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 -  http://blog.deconcept.com/swfobject/ - 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.


Code:
<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(
    "http://video.google.com/googleplayer.swf",
    "movie_player",
    "400",
    "326",
    7,
    "#000000");
    fo.addVariable("docId", "4472646496213461848");
    fo.write("swfplayer");
    // ]]>
</script>

Pasting it as is into a simple webpage will provide this:
http://moodsmusic.org/swfss.html

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

http://robertwatcher.com/toronto_wedding_photographers.php

(this is using a more complex XML based Flashplayer to produce the flash slideshow - not Google vids)
---
Logged
Pages: [1]   Top of Page
Print
Jump to:  

Ad
Ad
Ad