Jump to Content
Kimili
  • Journal
  • Portfolio
  • Projects
  • About
  • Contact

Placing YouTube videos in your blog with KFE

25 Feb 07

One of the most common questions I get about using Kimili Flash Embed is how to go about posting YouTube videos on a site with it. As you’ll see, it turns out to be a relatively simple and painless process.

YouTube’s Embed Code

As you probably already know, YouTube provides “Embed” code for just about every video on its site. It’s meant as an easy way to copy and paste the code to place a video onto your site / MySpace page, or whatever. It looks something like this:

  1. <object width="425" height="350">
  2. <param name="movie" value="http://www.youtube.com/v/crfrKqFp0Zg"></param>
  3. <param name="wmode" value="transparent"></param>
  4. <embed src="http://www.youtube.com/v/crfrKqFp0Zg" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
  5. </object>

There are a couple of reasons why copying and pasting the above HTML code is not exactly ideal. If you’re using the rich text editor to write your posts in Wordpress, for instance, it will treat the code as regular text, converting the brackets to character entities and will end up just displaying the code in your post for all to read. Not exactly what we wanted. Another reason that isn’t the ideal approach is that it doesn’t easily allow for alternate content such as an image or text stating that a user needs the Flash Player to watch the video. Besides, YouTube itself uses the SWFObject code – the same code that KFE is based on and utilizes – to post videos on its own site. If it’s good enough for them, it’ll work great for you.

KFE has 3 required attributes – movie, height and width. Remember that movie is the URL to the SWF file that we want to display. If we dissect the YouTube embed code, we find that we only need the first two lines in order to get all the information we need to create a valid KFE tag. Take a look:

  1. <object width="425" height="350">
  2. <param name="movie" value="http://www.youtube.com/v/crfrKqFp0Zg"></param>

Using that, I can just copy the three values to create my KFE tag. If you’re using Wordpress, it looks like this:

  1. [kml_flashembed movie="http://www.youtube.com/v/crfrKqFp0Zg" height="350" width="425" /]

For Textpattern users, it’s much the same:

  1. <txp:kml_flashembed movie="http://www.youtube.com/v/crfrKqFp0Zg" height="350" width="425" />

You can, of course adjust the height and width to fit the layout of your site if desired, or you can simply leave it as is.

Voilá  – that’s all there is to it. Nothing else is required or necessary.

Comments

Pamela says:
15 October 2007 ∞

Thanks for the information. I really help a dummbies for codes like me.

Bert (Stickske) says:
12 January 2008 ∞

Thanks, the information was usefull for me.

Marios says:
18 January 2008 ∞

Yeah, I’m glad I just found it.
I’ll let you know if trouble is at hand.

JFYI: By combining Pipes and Grazr, you can now also generate RSS Feeds in your custom Widgets. ( Just have to make the code more compliant )

Check it out here:
AlistAport

It is just not so Userfriendly. (fiddle around with the widget menu a bit)
Lets you play also the Videos right from within the widget.

Now, whenever I go to Youtube, those Playlist Feeds get updated automatically (RSS and OPML)

regards

Arjan says:
28 January 2008 ∞

Thanx for the info!! This is real easy

flv downloader says:
3 February 2008 ∞

Great tutorial! Thanks for sharing.

Deb Armp;d says:
18 April 2008 ∞

How would you put alt text into the above code?

Michael Bester says:
18 April 2008 ∞

Why not try the alttext attribute?

Deb Armp;d says:
19 April 2008 ∞

Where within the code does it get placed? I have tried several spots and it never shows?????

Michael Bester says:
19 April 2008 ∞

If you see the Flash, it doesn’t show. That’s why it’s alternative text. It’s for people who don’t have Flash installed.

Deb Armp;d says:
20 April 2008 ∞

So if I can’t see it but still wait to include it —- where should it go??????

Deb Armp;d says:
20 April 2008 ∞

I’m taking a class and we are required to enter the alt so I have disabled FLASH but can’t get the alt to display???

Michael Bester says:
20 April 2008 ∞

It’s an attribute that gets added to the tag like any other KFE attribute. Try this:

[kml_flashembed movie="http://www.youtube.com/v/crfrKqFp0Zg" height="350" width="425" alttext="This is your non flash content" /]

James says:
28 May 2008 ∞

Hi Michael,

I hate to add to what shouldn’t be an ongoing issue considering the simplicity of your instructions, but I’m having trouble embedding youtube files via your plugin.

I’ve tested embeddable urls from other streaming sites (imeem, animoto, google video, etc.) and I’ve also embedded swfs from my server directly, but for some reason the YouTube urls are not loading. An instance of the flash player loads but not the movie.

You mentioned that youtube is using the swfobject. Is it possible that they are using a later version of swfobject which may be causing a conflict with your plugin?

I’m using wp 2.5.1 hosted on mediatemple grid servers and the latest version of your plugin with just the default wp plugins.

Michael Bester says:
29 May 2008 ∞

@James – I saw your email. Please re-read the article above. When you define the movie parameter in your KFE tag, make sure you’re using the URL that YouTube generates in its video embed code, not the URL from the browser address bar. That’s not going to work for you.

trevor says:
23 December 2008 ∞

I’m not sure whether it’s because I’m using kimili 2.0 in its beta phase, but I’m finding that when i use the method described above, it works as it’s supposed to, TWICE. I end up with a floating video around my screen. Help!

trevor says:
23 December 2008 ∞

I just overcame this by inserting wordpress’ “MORE” tag just before the video.

thanks

Nicole says:
17 December 2009 ∞

Thanks for these tips. Do you know how to remove the video name from the embed code so that the name does not appear when I embed the video in my blog?

Your Turn





Flickr

  • Sailing on Federal
  • Bisection
  • Airstream
  • Light up the Sky
  • Roots in the Sky

See more at Flickr

Recent Listening

  1. Cujo - Adventures in Foam
  2. Frank Morgan - Frank Morgan
  3. Quadro Nuevo - Mocca Flor
  4. Sweetback
  5. The Budos Band
  6. Adele - 21
  7. The Budos Band - III
  8. Amon Tobin - Chaos Theory
  9. Sonny Rollins - Saxophone Colossus

See more at Last.fm

Tweet, Tweet

  • Daughter (4): “I know where Santa lives.”

    Me: “Where’s that?”

    D: “The North End.”

    Did he change his name to Santonioni?
    15 hours ago
  • The cover for this week’s New Yorker is absolutely inspired. http://t.co/lklpYoAs 1 day ago
  • Sailing on Federal http://t.co/PnceJdd7 6 days ago
  • My Perl chops are rubbish. Any Perl nerds out there care to give me an assist? http://t.co/xxQZJr3m Jan 24th
  • Presented without context: “Sucked into jet engine, subsequent encounter”. Jan 23rd

See more at Twitter

©MMII—MMXII Michael Bester