How to Add a Flash Video to a Custom Facebook Fan Page Tab
Recently I’ve been studying FBML (Facebook Markup Language) to spice up my Facebook fan page.
One thing that I’ve discovered is that the Facebook Developer’s Wiki, while full of useful information, is even more difficult to understand than the WordPress Codex. Either it’s for people way smarter than me or the developers don’t want us common folk to understand what the heck they are doing ;-) The examples, however, for each tag are very helpful.
Another good place to get information or assistance about FBML is on the Static FBML Discussion page. There are a lot of people answering questions, providing links to tutorials and demonstrating working snippets of code.
So, what I wanted to learn was how to add a flash video, such as a youtube video, to a custom Facebook fan page tab using FBML rather than a Facebook YouTube Application. This code can be used on it’s own video tab or even within an existing tab such as Welcome, About, etc.
The Instructions
- First, you will need to add the Static FBML application and create a custom tab, if you haven’t already done so.
- Locate your flash video. This would be the link on YouTube or it’s location on your server. The URL to my video that I’m using in this example is http://www.youtube.com/watch?v=J_CjzJqoYtc
- You also need an image. It can be one of the frames on youtube or an image you have on your server. 2.jpg seems to be the default image frame used in the YouTube examples.
- The FBML code you can start with looks like the following:
<fb:swf swfbgcolor="000000" imgstyle="border-width:3px; border-color:white;" swfsrc='http://www.youtube.com/v/xxxxxxxxxx' imgsrc='http://img.youtube.com/vi/xxxxxxxxxx/2.jpg' width='340' height='270' />
- The parts of this code that have to be changed are:
- swfsrc=’http://www.youtube.com/v/xxxxxxxxxx’
- imgsrc=’http://img.youtube.com/vi/xxxxxxxxxx/2.jpg’
- The xxxxxxxxxx part is the ID number of the youtube video that you are using. You replace this in both parts. The ID is the part of the URL after v= so in my example it would be J_CjzJqoYtc
- Other parts of the code can be changed but aren’t necessary for the video to work properly.
- swfbgcolor=”000000″ – this is the background color. 000000 is black.
- imgstyle=”border-width:3px; border-color:white; – this sets the width and color of the border around the video
- width=’340′ height=’270′ – the size of the video. Remember that when Facebook finishes making their changes to Tabs and Boxes the area to work with will only be 510px wide.
- The final code that I used looks like the following:
<fb:swf swfbgcolor="000000" imgstyle="border-width:3px; border-color:white;" swfsrc='http://www.youtube.com/v/J_CjzJqoYtc' imgsrc='http://img.youtube.com/vi/J_CjzJqoYtc/2.jpg' width='480' height='385' /> Click the image to start the video
- Please note that I added ‘Click the image to start the video’ below the code for the video. Facebook does not allow autoplay of these videos. It displays the image designated in our code. Clicking on that image will render the flash object and then the video can be started. Please don’t ask how to make the video autoplay – it can’t be done.
While working on this article, I made a simple tab called Video and added the code for it. You can view it on my fan page. And if you aren’t already a fan, it would be awesome if you became one.
I hope this was helpful. I’m still digging through the FBML documentation so I should have more articles for you soon.
photo credit: Velo Steve
Related Posts:









January 4, 2010 at 11:19 am
If the frequently asked questions from Facebook users are anything to go by, this will be an incredibly useful tutorial for many, Kim – thanks for digging through the FBML documentation and breaking the task into steps that the average human can follow!
Rebecca Leaman´s last blog ..32 Free Webinars for Nonprofits – January 2010
January 4, 2010 at 2:51 pm
Hi Rebecca – Thanks! And thanks for the retweet. We do need more fbml tutorials for the layperson ;-)
January 4, 2010 at 11:58 am
I often think that I’m such a text-focused person, I don’t use audio or video and I rarely watch them when others use them. But I know that in general, adding those to a site/ page is a good idea.
vered | blogger for hire´s last blog ..MomGrind: Best of 2009
January 4, 2010 at 2:52 pm
Hi Vered – Oh me too! Although we may be in the minority. I would much rather read a tutorial than watch a video. I actually get annoyed when the only tutorial I can find is a video ;-)
January 4, 2010 at 4:40 pm
Nice tutorial. I need to do some updates to my Facebook page, and maybe I’ll get to add some videos in the future. Thanks!
Kikolani´s last blog ..2010 Social Media Wishlist – New Features for Facebook, StumbleUpon, & Twitter
January 4, 2010 at 9:37 pm
Hi Krisit – With some styling the video could look really nice / cool. I was just trying to get it to work and didn’t do anything yet to actually make it pretty.
January 4, 2010 at 5:05 pm
Outstanding info! Thanks for sharing and making it easy to follow!
Rick Castellini´s last blog ..Free Airport WiFi
January 4, 2010 at 9:38 pm
Hi Rick – Thanks! And Happy New Year :-)
January 5, 2010 at 2:30 am
Need to do some research to complete my fan page.. Thanks for this info. I need to also learn a little bit of FB APIs for other application building purpose.
Ajith Edassery´s last blog ..A look back at 2009 and Blogging Objectives for 2010
January 5, 2010 at 8:54 am
Hi Ajith – The Developer’s Wiki is probably the best place to get info about the APIs.
January 5, 2010 at 8:49 am
Very nice Kim, I’m seriously thinking FB should put you on staff. ;)
Dennis Edell´s last blog ..PLEASE COMMENT – Have You EVER Used The Added Feature Of My Subscribe To Comments Plugin??
January 5, 2010 at 8:54 am
Hi Dennis – Hmm … I don’t know about that ;-)
January 5, 2010 at 1:51 pm
OKv then, how ’bout my personal FB guru when/if I decide to join again…one reason I canceled was the fact that I just didn’t get it.
Dennis Edell´s last blog ..Updates – Latest $10 Domain Winner, Latest Move News, and more.
January 5, 2010 at 7:02 pm
LOL
January 6, 2010 at 10:52 am
I was only half kidding – interested? ;)
Dennis Edell´s last blog ..Updates – Latest $10 Domain Winner, Latest Move News, and more.
January 6, 2010 at 3:02 pm
Dennis – Possibly. It’s something to discuss via email though.
January 7, 2010 at 8:05 am
Of course, if/when I rejoin, I’ll be in touch…
Dennis Edell´s last blog ..Updates – Latest $10 Domain Winner, Latest Move News, and more.
February 8, 2010 at 5:48 pm
~Hi Kim,
Thanks for posting this – Great info …
Ive being digging through numerous apps and code trying to do this..
..I guess its better to google and see how others did it!!
I now have a nice face book fan page with optin & video to boot !!
Thanks again.
- Jamie Dunne
PS:
Nice blog here.
Jamie Dunne´s last blog ..New IM Weapon – Easy Video Player !
February 9, 2010 at 10:41 am
Hi Jamie – Thank you so much! And I’m really glad this helped you get
the video on your fan page :-)