- Kelly's World- A View into the mind of Uber Geek, Kelly Adams - https://www.kgadams.net -

Posting Youtube content on WordPress…

Some folks might have noticed my posting of a Youtube “video” (actually, it’s mostly an “audio”, but that’s being picky) here a couple of days ago.  The really observant probably noted that it didn’t work the first 68 times I tried to publish it.  I thought I’d share a little about what I discovered in that process. 

The normal “embed” code from Youtube itself doesn’t seem to work, at least not with IE7.  It looks like this:

<object width=”425″ height=”350″>
<param name=”movie” value=”http://www.youtube.com/v/Hjhi_FHxY8k”></param [1]>
<param name=”wmode” value=”transparent”></param>
</object>

I did some poking around and found this thread of comments on the topic [2], which basically resolves that the underlying problem is that the Youtube embed code is improperly formed.  Within that thread is an alternate set of code that does work…it looks like this:

<object width=”425″ height=”350″ type=”application/x-shockwave-flash” data=”http://www.youtube.com/v/Hjhi_FHxY8k”><param [3] name=”movie” value=”http://www.youtube.com/v/Hjhi_FHxY8k [4]” /><param name=”wmode” value=”transparent” /></object>

Interestingly, it appears that WordPress likes to mess up the embed code even when it *is* correct.  I’d get it working, then edit the post and it would “break” the above code, removing some of the parameters.  Or at least that’s what it seemed to be doing. 

I finally got the post to work by turning off the rich editor in WordPress and using the second set of code above.  Hurray for persistance!