Embedding Dailymotion Videos as Valid XHTML 1.0

Album Cover: Crash

"You wear nothing, but you wear it so well."
Dave Matthews Band / Crash Into Me

Posted on November 23, 2006 12:44 PM in Web Development
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

Back in May I posted about how to embed YouTube videos as valid XHTML 1.0. Well, let's pretend for a moment that you've been using YouTube for a while, but recently received notice that your videos have been infringing too many copyrights. What do you do?

First off, you do some research and eventually decide to switch to YouTube's competitor overseas, Dailymotion.

Once you've done that, however, you quickly have to relearn what YouTube already taught you. When Dailymotion offers you a link to embed your video somewhere else, of course it isn't gonna be XHTML 1.0 compliant. That would be too easy. So you take the unnecessary mess they give you:

<div><object width="425" height="306"><param name="movie" value="http://www.dailymotion.com/swf/4wnX4yO5ANFCJ4RUx"></param><param name="allowfullscreen" value="true"></param><embed src="http://www.dailymotion.com/swf/4wnX4yO5ANFCJ4RUx" type="application/x-shockwave-flash" width="425" height="334" allowfullscreen="true"></embed></object><br /><b><a href="http://www.dailymotion.com/video/xovhh_jenny-mccarthy-on-my-name-is-earl">Jenny McCarthy on My Name is Earl</a></b><br /><i>Uploaded by <a href="http://www.dailymotion.com/bjms">bjms</a></i></div>

And you turn it into beautiful XHTML 1.0 goodness, like so:

<object type="application/x-shockwave-flash" width="425" height="306" data="http://www.dailymotion.com/swf/700Fkfr7ShJWH4RUx"><param name="movie" value="http://www.dailymotion.com/swf/700Fkfr7ShJWH4RUx" /></object>

I should note that I found several alleged solutions to this problem elsewhere on the web (DailyMotion's poor HTML code probably being the best of the bunch), but none of them seemed as clean, simple and browser-compliant as the solution I already came up with for YouTube videos. So if you're familiar with that previous example, this new one will look very familiar.

If it ain't broke, don't try to fix it.

Comments

Jeroen on May 03, 2008 at 4:55 AM:

Hey Bernie,

Amazing...
I didn't thought it would be possible to make something of the code provided by Dailymotion...
Thank you very much!

Permalink

Nicolas TAFFOREAU on May 18, 2008 at 10:22 AM:

Hi !

Thank's, you have THE solution !
I have a problem with the valid W3C when i put

...


Have you got a solution ?

http://www.inicolas.fr/life-cast/lifecast-4-365

Bye, Nicolas.

Permalink

Khan on May 07, 2009 at 8:22 AM:

i build my website.i put in my website video from "dailymotion" with dailymotion provided embed code.during playing video,when i click on video player screen,then open a new browser window of dailymotion whrere the video is.
what can i do that dailymotion window did not open ?
and my website visiter watch video just in my webpage.
thank u very much
Khan

Permalink

Jeroen on June 02, 2009 at 12:38 AM:

I don't think that would be possible...
You can't change the flash-file hosted on Dailymotion.
The only possibility is probably to host the video on your own site and use your own video.

Permalink

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.

Name:

Email Address:

Website:

Comments:

Check this box if you hate spam.