YouTube links now automatically embedded

Tools    





Now you don't have to wrap your YouTube links in tags. Or anything, for that matter. It'll now detect them pretty much however you post them: full URLs, shortened URLs, https:// instead of http://, whatever.




Just a quick heads-up: if you notice this being weird or temporarily not working, it's just me fiddling with it to try to get Vimeo support working.



"I didn't get that."

__________________
"Film is a disease. When it infects your bloodstream it takes over as the number one hormone. It bosses the enzymes, directs the pineal gland, plays Iago to your psyche. As with heroin, the antidote to Film is more Film." - Frank Capra



Okay, I just added support for Vimeo, too. It should process with or without URL tags, with or without the "www", and with http or https. So, pretty robust.




Okay, now that this is mostly working, a couple caveats. While you can almost always grab a URL from either site and have it work, there are a couple of small blind spots:
1) If you have a YouTube video with a bunch of stuff in the URL, and that stuff comes after the video's ID, it'll embed the video and print the extra stuff out afterwards.

2) If you use a shortened YouTube URL and you have it set to jump to a specific time in the video and you have a Vimeo URL after it and that Vimeo URL is on the same line and neither are in URL tags and you don't have "Automatically parse links in text" checked under Additional Options...then the Vimeo video won't show up.
You'll run into #1 a lot more than #2, and since it spits out the extra stuff you can clearly see what part you need to remove to avoid it, too. Other than that, you can do whatever: with or without the "www", with or without URL tags, http or https, separated by just a space, etc.

I might come back and try to make this thing completely airtight down the line, but for now there's a lot else to do and I think this should cover pretty much all typical use cases. So just let me know if you guys notice anything particularly crazy.



Update: this isn't strictly related to the original thread topic, but it seemed better to post it here than start a new thread (and bumping this for people still using YouTube tags can't hurt, anyway):

I've reworked embedded videos so that they display a preview image with a YouTube play icon, and only load the embedded video once you click on it. This makes them load a lot faster, and looks a lot cleaner, too. The performance difference on video heavy threads like What are you listening to while you're MoFoin' it? is particularly striking. I also took the liberty of bumping the video sizes up a bit, since there was a little room to spare.

As always, let me know if you guys notice any problems.



You can't make a rainbow without a little rain.
Update: this isn't strictly related to the original thread topic, but it seemed better to post it here than start a new thread (and bumping this for people still using YouTube tags can't hurt, anyway):

I've reworked embedded videos so that they display a preview image with a YouTube play icon, and only load the embedded video once you click on it. This makes them load a lot faster, and looks a lot cleaner, too. The performance difference on video heavy threads like What are you listening to while you're MoFoin' it? is particularly striking. I also took the liberty of bumping the video sizes up a bit, since there was a little room to spare.

As always, let me know if you guys notice any problems.

The only thing that I immediately noticed is that it no longer shows the title of the video.

I don't know if there's anything that you can do about that, so I guess this is just a note to let people know that they might want to include the artist's name and song title in their post with the video.



A good improvement Yoda! A title, as GBG says would be nice as it gives the potential viewer information on what they might be viewing.

Testing 1...2...3...4....5...



Yeah, the title thing did occur to me, and is unavoidable since getting it requires making an additional "request" from YouTube, which defeats most of the point. A bit of a tradeoff, I admit, but given the enhanced speed and aesthetics, I think a worthwhile one.

Of course, it also occurred to me that sometimes people use videos as a punchline or surprise, which now works a lot better.



You can't make a rainbow without a little rain.
Yeah, the title thing did occur to me, and is unavoidable since getting it requires making an additional "request" from YouTube, which defeats most of the point. A bit of a tradeoff, I admit, but given the enhanced speed and aesthetics, I think a worthwhile one.

Of course, it also occurred to me that sometimes people use videos as a punchline or surprise, which now works a lot better.

I had a feeling that it wouldn't be easy to include the title of the video, that's why I suggested that people add it themselves when they post the video. But given the two choices, the new way seems much better.

Thank you Yoda for all your hard work. It's greatly appreciated.



You can't make a rainbow without a little rain.
Yoda, I don't know if it matters, but I just posted a couple of YouTube videos on the "What are you listening to while you're MoFoin' it?" thread, and the preview screen still shows the original YouTube video image, with the video's title.

I doubt that it matters, but I just thought I'd mention it in case it means something to you from the programming point of view.



They both look normal for me. So my guess (please correct me if I'm mistaken) is that you added them via Quick Reply, and the post that showed up instantly showed the "old" version, but that when you reload, it's in the new format. Is that right?

If so, I'll have to figure out if it's worth the trouble to make them show up the same way instantly or not, since it's a pretty marginal difference and under fairly specific circumstances. But hey, maybe it'll be easy (note: it is usually not easy ).

EDIT: nevermind, done (it was sorta easy).