PDA

View Full Version : BB Code Enhancements - YouTube BB Code (W3C-compliant!)


Fangs404
10-21-2008, 10:00 PM
I searched for a decent YouTube BB code tag here, but every single one of them uses the embed tag, which is an illegal XHTML tag. I set out to find a way to create a W3C-compliant YouTube BB code tag, and this is what you see here.

Title: YouTube
BB Code Tag Name: youtube
Replacement: <object type="application/x-shockwave-flash" data="http://www.youtube.com/v/{param}&fs=1&hd=1" width="644" height="390"><param name="movie" value="http://www.youtube.com/v/{param}&fs=1&hd=1" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><a href="http://www.youtube.com/watch?v={param}">http://www.youtube.com/watch?v={param}</a></object>
Example: zlfKdbWwruY
Description: Embed a YouTube video. You <b>only</b> put the video ID in between the BB code tags (<b>NOT</b> the full URL!). Embedding <b>must</b> be enabled for the video!
Use Option: No
Image: https://vborg.vbsupport.ru/external/2009/01/66.jpg

Important Note!
A link to the YouTube video is displayed if the YouTube video fails to load. There are a variety of reasons this might occur:

- You didn't properly enter the video ID between the BB code tags.
- You don't have the latest version of Flash.
- You are using Firefox and have a conflicting extension (AdBlock, NoScript, a Greasemonkey script, etc).
- The video doesn't allow embedding.
- You have some other problem on your end (corrupt browser install, spyware, virus, etc.).
- YouTube is currently having a problem.

lucky51
10-22-2008, 10:52 AM
yes working thanks

SPARKS MAN
10-22-2008, 04:00 PM
thanks a lot i try it

Janfri
10-23-2008, 06:07 PM
Thanks a lot. Perfectly valid XHTML transitional. I have tried many bb codes for youtube, but this is the only one I have found that works with XHTML! Thank you very much!!!

gundrik
10-24-2008, 04:47 PM
bro, works perfrectly! finally someone who can easily explain how to do this! A+++++++

Barakat
10-25-2008, 09:07 AM
yap the same as iam useing in my codes ,,,,

https://vborg.vbsupport.ru/showthread.php?t=189497

thanks ,

Gleedo
10-26-2008, 10:21 AM
Good stuff, works a treat :)

Thanks

Fangs404
10-26-2008, 05:20 PM
Is this the same mod where I can just post a youtube embeded link and it turns into a video screen?
It sure is (except you don't post the full URL - just the video ID).

EWGF
10-26-2008, 06:49 PM
Very nice :D

Two times smaller than my previous code and your BORKED note is good to know too.

ShawneyJ
10-28-2008, 08:30 AM
cool ta ;)

Fangs404
10-29-2008, 05:55 AM
Is there a mod where you can just enter the youtube link from the browser address bar (i.e. http://www.youtube.com/watch?v=sm1IfqVofNA) and it turns into a video screen in the post?

https://vborg.vbsupport.ru/showthread.php?t=193151 supposedly does it, but several of the comments don't look too good. Plus, his code isn't W3C compliant.

Masiello
10-31-2008, 01:49 PM
Thanks a lot men :)

TheLastSuperman
11-02-2008, 12:04 AM
Thanks :D

Fangs404
12-13-2008, 05:48 AM
I just updated this to include a new tag (youtubehd) which enables embedding YouTube's new HD mode.

Fangs404
12-13-2008, 09:00 PM
And I just updated it once more to add support for HQ mode (which is better than regular but worse than HD).

SuperTaz
12-15-2008, 01:06 AM
Thank you. :D

Keesa
12-25-2008, 12:19 PM
Installed the HQ version so far. Not sure I have ever seen an HQ video yet

Daryn
12-26-2008, 01:07 AM
Most of the HD videos I see on youtube are at 1280x720. The HD tag embeds at 630x380. Changing the size in the embed code seems to work, but is there anything else to change to get the full size in an embed?

the stig
12-31-2008, 03:39 AM
BREAKING NEWS:

I don't know if YouTube did any tweaking or not, but if you put the embed code from a youtube video between embed code now, it embeds the video perfectly as well. One of our member just did it and I was shocked. Just wanted to let you guys know ;). I have double checked the fact that my html IS turned off.

Vaupell
01-01-2009, 11:05 AM
Installed and working, except when using the "botton" feature it adds spaces around
the video id, so you manually have to remove the extra spaces for it to work.

makes this


bIgslPPC1BA


instead of bIgslPPC1BA

Tx again.

But nice and installed. .

Phaedrus
01-02-2009, 06:07 AM
Would this work with other video sites, just setting the {param} differently?

Dingo14
01-02-2009, 09:01 PM
does anyone know if this draws on your server bandwidth to run the youtube videos like this just curious thanks

Fangs404
01-11-2009, 07:31 PM
Most of the HD videos I see on youtube are at 1280x720. The HD tag embeds at 630x380. Changing the size in the embed code seems to work, but is there anything else to change to get the full size in an embed?

I checked the size that YouTube actually uses (which isn't easily done since YouTube has a really complicated embedding scheme involving JavaScripts - I just took a screenshot and measured it), and it's actually not true 720p. YouTube displays at 858x508 for some odd reason, so that's what I'll alter the script to use.

Installed and working, except when using the "botton" feature it adds spaces around
the video id, so you manually have to remove the extra spaces for it to work.

makes this


bIgslPPC1BA


instead of bIgslPPC1BA

Tx again.



But nice and installed. .

I don't see this problem. When I hit the button, it just displays , no spaces or new lines. Glad you like it, though. :)

does anyone know if this draws on your server bandwidth to run the youtube videos like this just curious thanks

No, it doesn't use any bandwidth from your server.

Would this work with other video sites, just setting the {param} differently?

It's not quite that straightforward, but most video sites have embedding code. Just alter the URL before/after the {param} and it should work. I've already modified the same code for Vimeo.

dismas
01-13-2009, 06:26 AM
Does this, or any, embedded YouTube code make it so that "mature content" videos either can't be screened or have it so that the end user has to confirm that they are of age?

Phaedrus
01-13-2009, 07:09 PM
It's not quite that straightforward, but most video sites have embedding code. Just alter the URL before/after the {param} and it should work. I've already modified the same code for Vimeo.

Well, yeah, and you'd have to use different tags, but I can see what you mean.

Excellent. I think I'll do this rather than the passive hack.

See if I can get people used to it by disabling the other hack in other forums...

Fangs404
01-14-2009, 02:02 AM
I just tested it, and it appears that this does get by the age filter. The video I tried played just fine and didn't ask for an birthday or anything.

Chrakker
01-14-2009, 01:52 PM
I always can NOT drop down the Thread Tools Menue ever when a post has been made with a Video in it ;S
IS that a bug?
had to uninstall it, because of that ;S

Fangs404
01-14-2009, 03:06 PM
That's definitely not a bug with my BBCode. It's just a simple object HTML. It sounds like a browser bug on your end or maybe a bug with your template.

M3xital
01-14-2009, 07:49 PM
Hi,
Thanks a lot, it works great!

Gweebs
01-15-2009, 09:27 AM
Having problems with the youtube button image in the post a reply box. It works if I use a url from another site, but can't get it to link from my site (probably doing something wrong).

Also in FireFox it just shows the text and not a button (wrap [youtube] tags around text).
Probably because there's a prob with the image button.

Anyway, help!!!

Shaliza
01-15-2009, 11:40 AM
Such a small enhancement, but so useful. Makes things easier!

Fangs404
01-16-2009, 07:31 AM
Having problems with the youtube button image in the post a reply box. It works if I use a url from another site, but can't get it to link from my site (probably doing something wrong).

Also in FireFox it just shows the text and not a button (wrap [youtube] tags around text).
Probably because there's a prob with the image button.

Anyway, help!!!
Can you give me an example of how you're trying to use the command? You aren't putting the entire YouTube link in between the tags, right? As for why the button isn't showing up, it sounds like you have the image path wrong in the BBCode manager.

Also, please hit "Mark as Installed" to let me know that you're actually using it.

JackRock
01-17-2009, 04:32 AM
I feel a little noob-ish on this, but where do I actually enter that code? I've installed other mods before, but had never had to do one like this, and I'm delving into VB for the first time in earnest as an admin.

Digital Jedi
01-17-2009, 04:44 AM
I feel a little noob-ish on this, but where do I actually enter that code? I've installed other mods before, but had never had to do one like this, and I'm delving into VB for the first time in earnest as an admin.
You enter it in as a New BBCode in your Custom BBCode Manager.

JackRock
01-17-2009, 07:08 PM
You enter it in as a New BBCode in your Custom BBCode Manager.

THANK YOU! It's like the ONE area I hadn't explored in the ACP. installed

jlew24asu
01-17-2009, 08:00 PM
can someone please explain to me the whole "BORKED" thing?

Fangs404
01-18-2009, 01:39 AM
can someone please explain to me the whole "BORKED" thing?
If you see BORKED, it means that there's something wrong with your setup (your local setup). Maybe you don't have the latest version of flash. Maybe you have a funky Firefox extension installed. It just means something is preventing the flash video from being displayed on your machine.

PHILIPS-08
01-18-2009, 04:59 AM
thanx alot mate cool mod

jlew24asu
01-18-2009, 03:36 PM
If you see BORKED, it means that there's something wrong with your setup (your local setup). Maybe you don't have the latest version of flash. Maybe you have a funky Firefox extension installed. It just means something is preventing the flash video from being displayed on your machine.

thanks. that stinks. I dont know what could possibly be the issue. I have the latest flash version, and maybe a few FF plugins, but if I can see it on youtube's site, I dont know what would prevent me from posting it on my forum.

Fangs404
01-18-2009, 05:22 PM
thanks. that stinks. I dont know what could possibly be the issue. I have the latest flash version, and maybe a few FF plugins, but if I can see it on youtube's site, I dont know what would prevent me from posting it on my forum.
Which FF extensions do you have? Try disabling all of them and then see if it works. Does it work in IE?

ncrdave
01-18-2009, 08:36 PM
Installed!! Works great!! Thanks for a great, and easy mod!!

TheCorvetteForums.com ZR1 Video (http://forums.thecorvetteforums.com/showthread.php?t=579) :up:

jlew24asu
01-19-2009, 12:23 PM
Which FF extensions do you have? Try disabling all of them and then see if it works. Does it work in IE?

tab mix plus and foxy tunes. doesnt work in IE either. this is the vid im trying

http://www.youtube.com/watch?v=-zvCUmeoHpw



-------

Digital Jedi
01-19-2009, 08:21 PM
tab mix plus and foxy tunes. doesnt work in IE either. this is the vid im trying

http://www.youtube.com/watch?v=-zvCUmeoHpw



-------
This might seem like a silly question, but are you including the dash "-" ?

Fangs404
01-20-2009, 02:12 AM
This might seem like a silly question, but are you including the dash "-" ?
This is my guess as well. This is what the command should look like:

-zvCUmeoHpw

jlew24asu
01-20-2009, 02:41 PM
This might seem like a silly question, but are you including the dash "-" ?

not silly at all! I had no idea about the dash. thanks! where did I miss this instruction?

Digital Jedi
01-20-2009, 03:09 PM
not silly at all! I had no idea about the dash. thanks! where did I miss this instruction?
This ID number for a video begins immediately after the equals = symbol. So in this case, the dash was part of the ID.

jlew24asu
01-20-2009, 03:13 PM
This ID number for a video begins immediately after the equals = symbol. So in this case, the dash was part of the ID.

oh. ok. thanks for your help :)

the stig
02-02-2009, 07:11 PM
QUick question:

Can I change the value to 560 x 385 in the bbcode manager? the embed 425 x 344 is too small... thanks

Fangs404
02-04-2009, 12:54 AM
QUick question:

Can I change the value to 560 x 385 in the bbcode manager? the embed 425 x 344 is too small... thanks
I actually just checked YouTube's dimensions for regular and HQ, and it's 644x390 (HD is 858x508 for comparison). I went ahead and changed it. Thanks for the recommendation. :)

the stig
02-04-2009, 01:52 AM
What should I do now?

I have regular and HQ youtube bb code. Should I just change the BB codes in bb code manager? Will changing the bb code to a different dimension affect any of our previously embeded videos in various post/threads?

thanks.

Fangs404
02-04-2009, 04:17 AM
What should I do now?

I have regular and HQ youtube bb code. Should I just change the BB codes in bb code manager? Will changing the bb code to a different dimension affect any of our previously embeded videos in various post/threads?

thanks.
Yes, it'll change all instances of youtube or youtubehq to be the new dimensions, including the previously embedded ones.

the stig
02-04-2009, 11:43 PM
Yes, it'll change all instances of youtube or youtubehq to be the new dimensions, including the previously embedded ones.

Much thanks, sir. This is the best youtube embedding hack till date.

Fangs404
02-05-2009, 06:23 AM
Much thanks, sir. This is the best youtube embedding hack till date.
Thank you. That means a lot. :)

james-76
02-06-2009, 04:55 PM
When i try to post these videos in the first post as a thread they come up as BORKED on firefox. When they are a reply to a thread so the 2nd post or after they work perfectly.

Can you help?

http://www.birdiechance.co.uk/forums/showthread.php?p=84&posted=1#post84

forgive the forum its not quite ready for the official opening just yet.


EDIT:
Ok I realised the problem and it was the tags and link were not on the same line. Iwill post below incase others have the same issue


This works fine

1YQhoMt68CU

This comes up as BORKED and does not work

1YQhoMt68CU

Fangs404
02-06-2009, 09:58 PM
When i try to post these videos in the first post as a thread they come up as BORKED on firefox. When they are a reply to a thread so the 2nd post or after they work perfectly.

Can you help?

http://www.birdiechance.co.uk/forums/showthread.php?p=84&posted=1#post84

forgive the forum its not quite ready for the official opening just yet.


EDIT:
Ok I realised the problem and it was the tags and link were not on the same line. Iwill post below incase others have the same issue


This works fine

1YQhoMt68CU

This comes up as BORKED and does not work

1YQhoMt68CU



Yeah, what that'll do is try to make the URL include a return which I guess causes YouTube to throw a fit.

Also, I don't know if you guys knew this, but if you want to make the video autoplay, you can do something like this:

zlfKdbWwruY&autoplay=1

Just add &autoplay=1 to the end of the video ID.

the stig
03-20-2009, 02:07 AM
Mr. Fangs404, looks like YouTube changed their default video size again (for regular and HQ videos). Would you be kind enough to update the sizes again? thanks.

Fangs404
03-22-2009, 03:36 AM
Mr. Fangs404, looks like YouTube changed their default video size again (for regular and HQ videos). Would you be kind enough to update the sizes again? thanks.

Hm, according to my calculations, regular/HQ is 644x390 and HD is 858x508 which is what the BBCode uses currently. Are you seeing something different on your end?

Tannerman
03-25-2009, 09:13 PM
Has anyone noticed in the last week or so while using this modification that HQ videos are no longer defaulting in HQ mode when embedded? The HQ button is there, but it's no longer the default when the video starts. Did something change on the parameter level?

Fangs404
03-29-2009, 01:32 AM
I just removed the HQ YouTube tag (youtubehq). It's no longer necessary since the embedded player now has a HQ button built in. The embedded player actually also has an HD button if HD is enabled for the video, but I'm leaving the HD tag (youtubehd) because it's a physically larger player.

richardyoung
03-30-2009, 03:05 AM
NIce.. just installed and works great

james-76
03-30-2009, 08:49 AM
This is not working with firefox from today but works fine with IE.
http://www.birdiechance.co.uk/forums/showthread.php?t=601

Do you have any idea what the issue could be?

Fangs404
03-31-2009, 05:02 AM
It's working just fine for me. It's an issue on your end. Check that you have the latest version of Flash and that you have no conflicting FF extensions (check AdBlock or NoScript).

Fangs404
03-31-2009, 05:27 AM
I just modified both BB codes so that the full screen button is now available. I didn't realize it was missing until someone just told me yesterday.

james-76
03-31-2009, 07:48 PM
I have an idea that you might like to add :)

How you have "Borked"

I have changed it to "Video Error - Check here to make sure you have added it correctly."

This takes them to the FAQ so they can see the example etc.

Ok heres my idea I hope you are able to do it.

Instead of "Borked" could you make it so its an actual link to the correct video on youtube that opens in a new window? This way if the embedding fails on a site like it has mine a few times then it would show a link to video instead.

Thanks a lot :)

Fangs404
04-01-2009, 03:49 PM
I have an idea that you might like to add :)

How you have "Borked"

I have changed it to "Video Error - Check here to make sure you have added it correctly."

This takes them to the FAQ so they can see the example etc.

Ok heres my idea I hope you are able to do it.

Instead of "Borked" could you make it so its an actual link to the correct video on youtube that opens in a new window? This way if the embedding fails on a site like it has mine a few times then it would show a link to video instead.

Thanks a lot :)
I like that idea a lot.

james-76
04-02-2009, 07:07 AM
Maybe you could have it as:

"If no video is showing it could have been added incorrectly or there could be a technical issue.
Click here to view the video on youtube's site. (links to youtube and the correct video)

If you have added this video click here to make sure you have added it correctly. " (links to FAQ about youtube tag and example)

Of course the above would all be worded how you wish as I am just giving rough examples :p

It says a lot more than one word but it would stop us all coming back here asking whats the problem especially for human error.
I would think you could do this pretty easily but what do I know :eek:
Thanks for saying you liked the idea :) I hope at some point in the future you have some time to give it a try.

Regards,
James

Fangs404
04-02-2009, 07:40 PM
OK, here's what I changed it to.

Something went wrong. Please make sure you added the video correctly. Click <a href="misc.php?do=bbcode">here</a> to see how YouTube videos should be embedded. There could also be a technical issue that's not your fault. Click <a href="http://www.youtube.com/watch?v={param}">here</a> to view the video on YouTube's site. If this link doesn't work, you did something wrong.

Thanks for the recommendation. Hopefully this'll save some headaches.

james-76
04-02-2009, 08:22 PM
Thit is perfect :) Thanks very much for your time.

I altered it a little on my site so itgoes straight to the youtube bbcode instead of all bb codes.

<a href="misc.php?do=bbcode#youtube" target="_blank">

Also I made both links open in seperate windows as this suits me but may not suit others :)

Thanks once again.



<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/{param}&fs=1" width="644" height="390"><param name="movie" value="http://www.youtube.com/v/{param}&fs=1" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" />Something went wrong. Please make sure you added the video correctly. Click <a href="misc.php?do=bbcode#youtube" target="_blank">here</a> to see how YouTube videos should be embedded. There could also be a technical issue that's not your fault. Click <a href="http://www.youtube.com/watch?v={param}" target="_blank">here</a> to view the video on YouTube's site. If this link doesn't work, you did something wrong.</object>

Fangs404
08-12-2009, 03:56 AM
Unfortunately, it appears that YouTube has removed the ability to embed HQ and HD videos using the &fmt=22 trick. As a result, I'm going to remove the youtubehd tag from my script.

Fangs404
08-17-2009, 08:06 PM
OK, HD videos will work again. I had to change &fmt=22 to &hd=1.

GuyUltimate
10-11-2009, 02:37 AM
where do u install it?
how?

please leave a little bit of installation guide...
thanks!

Fangs404
10-12-2009, 09:40 PM
where do u install it?
how?

please leave a little bit of installation guide...
thanks!
Just like every other BB code. Go into the admin console, and go to the BB code section.

the stig
10-22-2009, 04:46 AM
hey fangs, I have your old version where it said "borked". I see that you've done a lot of changes to the code and it's very nice now. If I were to replace old codes for the new ones, will my old embed work properly?

thanks.

Fangs404
10-24-2009, 07:13 PM
hey fangs, I have your old version where it said "borked". I see that you've done a lot of changes to the code and it's very nice now. If I were to replace old codes for the new ones, will my old embed work properly?

thanks.
Yes, the old embeds will continue to work properly.

the stig
10-26-2009, 07:31 AM
Yes, the old embeds will continue to work properly.

You're full of awesomeness. I wish you had a "Donate" button. :)

gonedigital
12-03-2009, 05:11 PM
Installed the Standard and Hi-Def tags. worked great thanks.

Cobro
12-03-2009, 07:20 PM
Works great on 3.8.2
Thank you very much

enemy@fps
02-05-2010, 11:34 AM
thanks ;)

Bulent Tekcan
05-01-2011, 09:55 AM
is it possible to disable quote ? I need if anyone use quote this is convert to link only.

Sworm
05-01-2011, 10:13 AM
is it possible to use full youtube url ?

Yes, should be really great.... not more users will take the full url in the tags....