Log in

View Full Version : YouTube links now automatically embedded


Yoda
03-04-14, 02:37 PM
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.

http://www.youtube.com/watch?v=HHfOejlvVsY

earlsmoviepicks
03-04-14, 03:14 PM
http://www.youtube.com/watch?v=daSG5fwdA7o

Hit Girl
03-04-14, 03:21 PM
http://movingcars.com.au/mainsite/wp-content/uploads/2012/08/excellent-car-transport.jpg

Sexy Celebrity
03-04-14, 03:22 PM
http://www.youtube.com/watch?v=bBQVrCflZ_E

mark f
03-04-14, 03:57 PM
Works great!

christine
03-04-14, 06:15 PM
Brilliant! Thanks. I always used to have trouble with doing YouTube links for some reason

Yoda
03-05-14, 02:31 PM
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. :)

Holden Pike
03-05-14, 03:16 PM
"I didn't get that."

http://www.youtube.com/watch?v=sXGzO2aDDRU

Yoda
03-05-14, 05:29 PM
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.

http://vimeo.com/23685613

Rhys
03-05-14, 05:30 PM
Ohh that's why I couldn't find the tag button for it. Awesome!

Yoda
03-05-14, 05:44 PM
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. :)

Mesmerized
03-08-14, 01:32 PM
Thank you!


http://www.youtube.com/watch?v=GITb6rzpTWM

Yoda
09-15-14, 04:56 PM
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? (http://www.movieforums.com/community/showthread.php?t=2369&page=621) 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. :)

gbgoodies
09-15-14, 05:07 PM
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? (http://www.movieforums.com/community/showthread.php?t=2369&page=621) 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.

Citizen Rules
09-15-14, 05:11 PM
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...
http://www.youtube.com/watch?v=mRmKzxhMzwo

Yoda
09-15-14, 05:28 PM
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. :)

gbgoodies
09-15-14, 05:33 PM
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. :)

Citizen Rules
09-15-14, 05:51 PM
that's why I suggested that people add it themselves when they post the video.

That's a perfect solution.So that's Laverne & Shirley opening credits theme song^

gbgoodies
09-15-14, 05:51 PM
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.

Yoda
09-15-14, 05:54 PM
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 :D).

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

Citizen Rules
09-15-14, 06:08 PM
I just posted a utube video of a King Kong clip on Born Today thread. After submitting I clicked edit to add a few words and my browser froze. I had do do a hard shut off of my computer. It could be a fluke but you might want to check out the edit feature with a posted utube video with Firefox browser. I use Windows 7.

Yoda
09-15-14, 06:09 PM
Yeah, sorry, I was literally in the middle of fixing the issue gbgoodies just mentioned. It should be fine now; please confirm, if you would. :)

Citizen Rules
09-15-14, 06:10 PM
Hi, I just tried the edit feature and it worked good this time!

gbgoodies
09-15-14, 06:12 PM
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 :D).

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


I posted using the "Post Reply" button on the bottom left of the last post, and then I clicked on "Preview Post" before and looked at the image before I posted it.

The Preview showed the old version of the YouTube video, but after it posted, it showed the new version. I'm using Windows 8 and Google Chrome if that makes a difference.

It doesn't seem to be a problem. I just thought it might affect the loading speed of the page.

I rarely use the "Quick Reply" button.

gbgoodies
09-15-14, 06:13 PM
You can disregard my previous post. I just noticed that your edit saying that you already fixed it.

Citizen Rules
09-15-14, 06:14 PM
I noticed the old Utube video look in preview and the new clean look on an actually post. But not a problem.

I haven't noticed more bandwidth being used. But if that was the case it would severally limit my viewing of threads with embedded videos, as I have a slower DSL connection. So far so good.

Yoda
09-15-14, 06:15 PM
Ahhh, Preview. I'll go fix that too (that one's easy). I assumed you meant Quick Reply, but hey, that's good because now that's fixed, too.

Thanks guys. :)

Kaplan
09-15-14, 06:23 PM
That's a lot better. I'd just clicked on Iroquois' favorite album thread yesterday and was noting how long it took for the pages to load.

gbgoodies
09-15-14, 06:24 PM
Ahhh, Preview. I'll go fix that too (that one's easy). I assumed you meant Quick Reply, but hey, that's good because now that's fixed, too.

Thanks guys. :)


Yeah, it looks like it's fixed now. :)

Yoda
09-15-14, 06:26 PM
That's a lot better. I'd just clicked on Iroquois' favorite album thread yesterday and was noting how long it took for the pages to load.
Cool. :)

Yeah, the problem has bugged me for awhile. A couple months ago I tried to tweak a script that only loads embedded videos when they scroll into view, but had some issues with it. This one took some modification, too, but went a lot better. But now I might double back and do that, too, to multiply the improvement.

n3wt
09-15-14, 07:11 PM
This is cool man :highfive:

Yasashii
10-12-14, 12:27 AM
I'm grateful for the effort and I sure enjoy the results. I do have a thing to say, though, and keep in mind it's not a complaint, just a little "bug report", if you will:

The YouTube "Start playback from:" feature doesn't seem to work in the embedded videos.

I just posted a video in my review of Les Choristes and set it to start at 0:25 but it always starts from the beginning. I pasted the link properly because it has the "t=25s" at the end.

It's not a problem by any means, I just thought you might wanna know.

Yoda
10-12-14, 03:52 PM
Yeah, it didn't under the old way, either, unfortunately. Kinda tricky. But I was so focused on just getting the automatic parsing working that I might not have looked as closely at the time thing as I could have. I'll toss it on the to-do list and see if it's do-able. Thanks for the suggestion. :)