Embedding YouTube video as valid XHTML

Topics: Controls
Apr 25, 2008 at 3:11 AM
I'm trying to embed a YouTube video as valid XHTML 1.0 Transitional. By pasting code like the following into the HTML editor, I can embed with no problem:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="363" height="303">
<param name="width" value="363" />
<param name="height" value="303" />
<param name="wmode" value="transparent" />
<param name="src" value="http://www.youtube.com/v/okOBUp0oaNM&rel=1" />
<embed type="application/x-shockwave-flash" width="363" height="303" wmode="transparent" src="http://www.youtube.com/v/okOBUp0oaNM&rel=1"></embed>

After reading about how to do this without the invalid embed tag, I tried pasting the following into the HTML editor in the same way:

<object type="application/x-shockwave-flash" style="width:363px; height:303px;" data="http://www.youtube.com/v/okOBUp0oaNM">
<param name="movie" value="http://www.youtube.com/v/okOBUp0oaNM" />

But this gets mangled by the HTML editor; when I switch back to HTML view I see the following:

From the <a href="http://www.portablefilmfestival.com/" target="_blank" title="Portable Film Festivle">Portable Fiml Festival</a>: Some people, in order, from age 1 to 100:
<div style="width: 363px; height: 303px">

I saw the link to the YouTube extension on the Extensions page, but the link goes to a blog that doesn't appear to offer anything like that (not that I could find, anyway).

Any ideas on how I might accomplish this?

Thanks, -Christopher

Apr 26, 2008 at 3:20 PM
Chris, I think the best way might be to use SWFObject. This is what I did in my FlashVideo extension and you could copy the code from there:

Apr 28, 2008 at 10:22 AM
use the insert media tool button.... i tried it and it works with your code, showing a preview and everything. i had the same issue with flash and it worked well
Apr 28, 2008 at 12:33 PM
The YouTube Extension disappeared from Mads' blog (not sure why though).

You can download YouTube Extension here ( 1kb .zip)
(it's a copy I downloaded a few months ago, just extract the .cs file into your /extensions folder)

Love the ease of use: simply look up the YouTube ID (okOBUp0oaNM in your example) and type this in your blog post:


Cheers Mike