The online racing simulator
You Tube, Forum Embed
(6 posts, started )
You Tube, Forum Embed
I was coding this last night for a project of my own and it ocurred to me, with the amount of you tube links that get posted on this forum, why doesn't the forum support it natively?

I didn't see it discussed anywhere (I looked, sorry if I missed it), so I thought i'd suggest it.

Also, seeing a I coded it last night, I thought i'd throw in the code to do it too:


preg_replace(
'/\[youtube\](.*)\[\/youtube\]/i'
,"<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://youtube.com/v/$1\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://youtube.com/v/$1\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object>"
)

This takes the vid of the you tube parameter between a [youtube] tag and then embeds it without a subdomain for maximum compatibility with mobile devices.
I don't really see the need for it, but I'm not necessarily against it. Though if included, it should produce valid XHTML.
Embed is not necessary anyway, I have yet to come across a mobile device that supports embedded media but not the proper way of embedding it. As for older browsers... the way I see it, incompatible markup can only help get rid of those.
That's the embed code lifted directly off the youtube site and modified to take the regex parameters .

You do have a point on the mobile devices though, although the point still stands for regionalised you tube versions, i've found that dropping the subdomain from youtube links is the safest method to circumnavigate issues that arrise from it.
Quote from Becky Rose :That's the embed code lifted directly off the youtube site and modified to take the regex parameters .

You do have a point on the mobile devices though, although the point still stands for regionalised you tube versions, i've found that dropping the subdomain from youtube links is the safest method to circumnavigate issues that arrise from it.

I was actually talking about the <embed>, which is not part of the XHTML specification. Dropping the subdomain is good practice in this case since it serves no purpose anyway, in fact it never does AFAIK. They'll select the language based on the client IP or the browser's accept-language, or the language set for your account if you're logged in. No idea why the subdomains exist.

HTML 4.01 Transitional (which is very loose) and they still managed 309(!) errors on the personalised front page alone... Seems the way to success in webdevelopment is horrid markup, YouTube, Facebook, MySpace, ... they're all invalid, even slashdot... Dark times if even the nerds can't be bothered to form valid markup :melting:
This is pretty much common in other forums. I'm not too partial to it as it just adds extra elements that take up space, unless it could be limited to say one or two embeds per post it's pretty open to being an annoyance generator. Links to youtube videos are good for several reasons: you get a choice, you can open it in another window/tab right away, their title gets stored in browser history so you can recall them pretty quickly instead of "oh where was that thing in that thread that someone said ... something .... ".
it seems like clicking on any embedded youtube videos opens a new tab with youtube.com and stop the embedded video from loading any further instead of pausing/resuming the video like it should
which is utterly infuriating

You Tube, Forum Embed
(6 posts, started )
FGED GREDG RDFGDR GSFDG