How to embed YouTube videos in SMF forum

There is a mod for SMF that allows you to embed YouTube videos fairly easily, but I didn't find it until after I worked out a way that I think works as well and doesn't take a separate modification, plus it's pretty mindless to add Google or Yahoo videos as well.

I had the Custom BBC mod already installed on one of my forums so I decided to start there.

Once the Custom BBC mode is installed you go to your Admin Panel, click on the Features and Options link, and then the Custom BBC tab. You'll see an image like the one below. Yours probably won't have any tags yet though.

custom_bbc_list.png

Click on the Create a new tag link and you'll see the following screen.

custom_bbc_new.png

Enter youtube for the tag name and whatever you want for the description. Check the checkbox next to Block level so that the videos are a block level element in your post. The Tag type, Parse enclosed BBCode, and Trim whitespace settings can be left as-is.

Paste the following HTML into the last box.

CODE:
  1. <object height="350" width="425"></object>
  2.  
  3. <param name="movie" value="http://www.youtube.com/v/{content}"></param>
  4. <param name="wmode" value="transparent"></param>  <embed src="http://www.youtube.com/v/{content}" type="application/x-shockwave-flash" wmode="transparent" height="350" width="425"></embed>

Click save to save it and you'll be taken back to the list of BBCode tags. Check the Enable check box next to your new tag and click Save to turn on the tag.

Now all you have to do is put [youtube]video_id[/youtube] into a post, so if you wanted to embed a video with the id (it's the v variable on the YouTube page) of vIFCV2spKtg you would put [youtube]vIFCV2spKtg[/youtube].

If you want to see what it looks like live, here's a link to a post that's using the same technique.

Question, Comments...

Do you have more questions. Please either leave a comment below or join us in our new forum.

13 Responses to “How to embed YouTube videos in SMF forum”

  1. How can I modify the script from above so that I can diplay videos that I have uploaded to my own server? I would like to embed them just as the the Youtube videos rather than simpkly posting the link.

    Thanks

  2. I would imagine it would depend on the format of the video.

    You’ll need to figure out what HTML is used to normally embed the video and use it in the HTML box. Use the {content} tag to allow you to enter whatever the path is to the video.

    Without knowing what format you’re talking about though I can’t give anymore concrete suggestions.

  3. I cannot get this preview to embed, what are the changes I need to make to the html to make this mod do this?

  4. html for embedding went missing… ?!

  5. This is what I am trying to work with:

  6. Lou, I just double checked the forum I’m using this on and it still works. What exactly is happening, or isn’t happening?

  7. [...] a year ago I wrote a post on how to embed a YouTube video in a Simple Machines Forum post. Well, as it works out today I needed to embed a Google Video in a post so I went through and did [...]

  8. flv

  9. I installed this mod but it did not show up in the admin section anywhere.

  10. same here. I cant find it on the Features and Options.

  11. It depends on what they you’re using. I think it’ll do it automatically with the default, but if you’re using something else you may have to do a little more work.

  12. Anyone know how to solve the custombbcode-wont-show-up-in Features and Options. I’ve checked all the files and theyre correctly pathced. Running SMF 1.1.11

    Thanks for any help.

  13. Works great, thanks. The plugin we’re using seems to allow only one command line parameter; know of any solution that would allow more? I’d like to be able to specify the video width and height from the command line. I suppose I could create a new BBCode for each size requirement, but that might get a little tedious.

Leave a Reply